From fce8bb9c29d18f758d15eb5301e2f79f75c469fe Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Fri, 12 Oct 2012 14:09:06 +0530 Subject: [PATCH] [IMP]project_timesheet:added method for setting default product uom. bzr revid: kbh@tinyerp.com-20121012083906-3ab8ephqoc09dx7z --- addons/project_timesheet/project_timesheet.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 2154f6d89dd..3e72a7e7522 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -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()