[IMP]project_timesheet:added method for setting default product uom.
authorKhushboo Bhatt (Open ERP) <kbh@tinyerp.com>
Fri, 12 Oct 2012 08:39:06 +0000 (14:09 +0530)
committerKhushboo Bhatt (Open ERP) <kbh@tinyerp.com>
Fri, 12 Oct 2012 08:39:06 +0000 (14:09 +0530)
bzr revid: kbh@tinyerp.com-20121012083906-3ab8ephqoc09dx7z

addons/project_timesheet/project_timesheet.py

index 2154f6d..3e72a7e 100644 (file)
@@ -293,8 +293,18 @@ class account_analytic_line(osv.osv):
             return employee.product_id.id
         return False
 
+   def _default_product_uom(self, cr, uid, context=None):
+        proxy = self.pool.get('hr.employee')
+        record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context)
+        print "record_ids",record_ids
+        employee = proxy.browse(cr, uid, record_ids[0], context=context)
+        if employee.product_id and employee.product_id.uom_id:
+            return employee.product_id.uom_id.id
+        return False
+
    _defaults = {
         'product_id': _default_product,
+        'product_uom_id': _default_product_uom,
         }
 
 account_analytic_line()