summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2012-06-25 10:43:13 +0200
committerRaphael Collet <rco@openerp.com>2012-06-25 10:43:13 +0200
commitef87129d694e56ccd6bb874482769bf845dfd532 (patch)
tree38c13a6e0b6794d87e11048dbca5bcbb8b876463 /addons
parent774e54bda1d964894621d17c021b76a22cabe880 (diff)
[IMP] project: simplify code and improve res.company inherited view
bzr revid: rco@openerp.com-20120625084313-atvbr3hc8940whtt
Diffstat (limited to 'addons')
-rw-r--r--addons/project/project_view.xml6
-rw-r--r--addons/project/res_config.py27
2 files changed, 12 insertions, 21 deletions
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index f883f007bd6..84c65777e95 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -750,9 +750,9 @@
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<page string="Configuration" position="inside">
- <separator string="Project Management" colspan="4"/>
- <field name="project_time_mode_id" domain="[('category_id','=','Working Time')]"/>
- <newline/>
+ <group string="Project Management">
+ <field name="project_time_mode_id" domain="[('category_id','=','Working Time')]"/>
+ </group>
</page>
</field>
</record>
diff --git a/addons/project/res_config.py b/addons/project/res_config.py
index 035ef600c4f..b112506e073 100644
--- a/addons/project/res_config.py
+++ b/addons/project/res_config.py
@@ -47,7 +47,7 @@ class project_configuration(osv.osv_memory):
'module_project_issue': fields.boolean("Issues and Bug Tracking",
help="""Provides management of issues/bugs in projects.
This installs the module project_issue."""),
- 'time_unit': fields.many2one('product.uom', 'Working Time Unit', required=True,
+ 'time_unit': fields.many2one('product.uom', 'Working Time Unit', required=True,
help="""This will set the unit of measure used in projects and tasks."""),
'module_project_issue_sheet': fields.boolean("Track and Invoice Issues Working Time",
help="""Provides timesheet support for the issues/bugs management in project.
@@ -60,25 +60,16 @@ class project_configuration(osv.osv_memory):
help="Allows you to compute Time Estimation on tasks."),
'group_manage_delegation_task': fields.boolean("Manage Task Delegation",
implied_group='project.group_delegate_task',
- help="Allows you to delegate tasks to other users."),
+ help="Allows you to delegate tasks to other users."),
}
-
-
- def _get_default_time_unit(self, cr, uid, context=None):
- res = {}
- product_uom_obj = self.pool.get('product.uom')
+
+ def get_default_time_unit(self, cr, uid, fields, context=None):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
- res['time_unit'] = user.company_id.project_time_mode_id.id
- return res.get('time_unit', False)
+ return {'time_unit': user.company_id.project_time_mode_id.id}
- _defaults = {
- 'time_unit': _get_default_time_unit,
- }
- def set_project_defaults(self, cr, uid, ids, context=None):
- wizard = self.browse(cr, uid, ids)[0]
- if wizard.time_unit:
- user = self.pool.get('res.users').browse(cr, uid, uid, context)
- user.company_id.write({'project_time_mode_id': wizard.time_unit.id})
- return {}
+ def set_time_unit(self, cr, uid, ids, context=None):
+ config = self.browse(cr, uid, ids[0], context)
+ user = self.pool.get('res.users').browse(cr, uid, uid, context)
+ user.company_id.write({'project_time_mode_id': config.time_unit.id})
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: