Bharat Devnani (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-application_setting_cleanup-atp-project-improvements-bde
 into lp:~openerp-dev/openobject-addons/trunk-application_setting_cleanup-atp.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-application_setting_cleanup-atp-project-improvements-bde/+merge/109599

Hello Sir, 

I have added functionality of working time unit in project configuration.

Thanks & Regards,
Devnani Bharat R.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-application_setting_cleanup-atp-project-improvements-bde/+merge/109599
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openobject-addons/trunk-application_setting_cleanup-atp-project-improvements-bde
 into lp:~openerp-dev/openobject-addons/trunk-application_setting_cleanup-atp.
=== modified file 'project/res_config.py'
--- project/res_config.py	2012-06-08 06:23:18 +0000
+++ project/res_config.py	2012-06-11 10:23:20 +0000
@@ -20,6 +20,7 @@
 ##############################################################################
 
 from osv import osv, fields
+from tools.translate import _
 
 class project_configuration(osv.osv_memory):
     _name = 'project.config.settings'
@@ -46,7 +47,7 @@
         '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'),
+        'time_unit': fields.many2one('product.uom', 'Working Time Unit', required=True),
         'module_project_issue_sheet': fields.boolean("Track and Invoice Issues Working Time",
             help="""Provides timesheet support for the issues/bugs management in project.
                 This installs the module project_issue_sheet."""),
@@ -57,5 +58,27 @@
             implied_group='project.group_time_work_estimation_tasks',
             help="Allows you to compute Time Estimation on tasks."),                                
     }
+    
+    def default_get(self, cr, uid, fields, context=None):
+        res = {}
+        user = self.pool.get('res.users').browse(cr, uid, uid, context)
+        res['time_unit'] = user.company_id.project_time_mode_id.id
+        return res
+    
+    def _get_default_time_unit(self, cr, uid, context=None):
+        product_uom_obj = self.pool.get('product.uom')
+        ids = product_uom_obj.search(cr, uid, [('name', '=', _('Hour'))], context=context)
+        return ids and ids[0] or False
+
+    _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 {}
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'project/res_config_view.xml'
--- project/res_config_view.xml	2012-06-08 06:23:18 +0000
+++ project/res_config_view.xml	2012-06-11 10:23:20 +0000
@@ -19,7 +19,7 @@
                         <separator string="Project" colspan="4"/>
                         <field name="group_time_work_estimation_tasks"/>
                         <field name="group_tasks_work_on_tasks"/>
-                        <field name="time_unit"/> 
+                        <field name="time_unit" domain="[('category_id.name','=','Working Time')]"/> 
                         <field name="module_project_mrp"/>
                         <field name="module_project_timesheet"/>
                         <field name="module_pad"/>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to