diff options
| author | Priyesh <solanki.priyesh@gmail.com> | 2008-09-12 11:12:31 +0530 |
|---|---|---|
| committer | Priyesh <solanki.priyesh@gmail.com> | 2008-09-12 11:12:31 +0530 |
| commit | c22ef987b50cbf2518180794264f41bc7d4fc134 (patch) | |
| tree | 8bb79db7f1e4c7d9018302f35a4566984c59087a /addons | |
| parent | d683c8d025c6a0de4b482b77caac6a28eb00e50a (diff) | |
changes in project.py and project_view.xml
bzr revid: solanki.priyesh@gmail.com-20080912054231-xrso21mkmyyd8hfv
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/hr_holidays/report/holidays_summary_report.py | 3 | ||||
| -rw-r--r-- | addons/product/security/product_security.xml | 1 | ||||
| -rw-r--r-- | addons/project/project.py | 45 | ||||
| -rw-r--r-- | addons/project/project_view.xml | 6 |
4 files changed, 30 insertions, 25 deletions
diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index e450efc6890..c4b7158b05c 100644 --- a/addons/hr_holidays/report/holidays_summary_report.py +++ b/addons/hr_holidays/report/holidays_summary_report.py @@ -66,7 +66,7 @@ def emp_create_xml(self,cr,uid,dept,holiday_type,row_id,empid,name,som,eom): return xml class report_custom(report_rml): - def create_xml(self, cr, uid, ids,data, context): + def create_xml(self, cr, uid, ids, data, context): depts=[] emp_id={} done={} @@ -86,7 +86,6 @@ class report_custom(report_rml): som = strToDate(first_date) eom = som+datetime.timedelta(59) - day_diff=eom-som if data['form']['holiday_type']!='both': diff --git a/addons/product/security/product_security.xml b/addons/product/security/product_security.xml index 89530976a32..208a5f66af3 100644 --- a/addons/product/security/product_security.xml +++ b/addons/product/security/product_security.xml @@ -11,3 +11,4 @@ </data> </openerp> +<!-- -->
\ No newline at end of file diff --git a/addons/project/project.py b/addons/project/project.py index 50d62a91982..7ddca9ec22b 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -150,31 +150,36 @@ class project(osv.osv): # toggle activity of projects, their sub projects and their tasks def settemplate(self, cr, uid, ids, context={}): - b_obj = self.browse(cr, uid, ids)[0] - task_data = self.pool.get('project.task').search(cr, uid, [('project_id','in',ids)]) - for id in task_data: - self.pool.get('project.task').write(cr, uid, id, {'active':False}) - return self.write(cr, uid, ids, {'state':'template'}) - + res = self.setActive(cr, uid, ids, value=False, context=context) + return res + def resetproject(self, cr, uid, ids, context={}): - cr.execute('select id from project_task where project_id in ('+','.join(map(str, ids))+')') - for id in cr.fetchall(): - self.pool.get('project.task').write(cr, uid, id[0], {'active':True}) - return self.write(cr, uid, ids, {'state':'open'}) + res = self.setActive(cr, uid, ids,value=True, context=context) + return res def duplicatetemplate(self, cr, uid, ids, context={}): - return self.pool.get('project.project').copy(cr, uid, ids[0], context=context) + proj = self.browse(cr, uid, ids[0], context) + self.pool.get('project.project').copy(cr, uid, ids[0],default={'state':'template'}, context=context) + cr.execute('select id from project_task where project_id=%d', (proj.id,)) + res = cr.fetchall() + tasks_ids = [x[0] for x in res] + if tasks_ids: + for i in tasks_ids: + self.pool.get('project.task').copy(cr, uid, i,default={'active':False}, context=context) + project_ids = [x[0] for x in res] + return True # set active value for a project, its sub projects and its tasks - def setActive(self, cr, uid, id, value, context={}): - proj = self.browse(cr, uid, id, context) - self.write(cr, uid, [id], {'active': value}, context) - cr.execute('select id from project_task where project_id=%d', (proj.id,)) - tasks_id = [x[0] for x in cr.fetchall()] - self.pool.get('project.task').write(cr, uid, tasks_id, {'active': value}, context) - project_ids = [x[0] for x in cr.fetchall()] - for child in project_ids: - self.setActive(cr, uid, child, value, context) + def setActive(self, cr, uid, ids, value=True, context={}): + + for proj in self.browse(cr, uid, ids, context): + self.write(cr, uid, [proj.id], {'state': value and 'open' or 'template'}, context) + cr.execute('select id from project_task where project_id=%d', (proj.id,)) + res = cr.fetchall() + tasks_id = [x[0] for x in res] + if tasks_id: + self.pool.get('project.task').write(cr, uid, tasks_id, {'active': value}, context) + project_ids = [x[0] for x in res] return True project() diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 01727d201db..af462a90ad8 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -32,9 +32,9 @@ <field colspan="4" name="members" nolabel="1"/> <group col="6" colspan="8"> <field name="state"/> - <button name="settemplate" string="set as template" type="object" states="open"/> - <button name="resetproject" string="reset as project" type="object" states="template"/> - <button name="duplicatetemplate" string="duplicate template" type="object" states="template"/> + <button name="settemplate" string="Set as Template" type="object" states="open"/> + <button name="resetproject" string="Reset as Project" type="object" states="template"/> + <button name="duplicatetemplate" string="Duplicate Template" type="object" states="template"/> </group> </page> <page groups="base.group_extended" string="Partner Info"> |
