diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index ea0826678ec..de448ced584 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -80,7 +80,7 @@ class hr_analytic_timesheet(osv.osv): emp_obj = self.pool.get('hr.employee') emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context) if emp_id: - emp=emp_obj.browse(cr, uid, emp_id[0], context=context) + emp = emp_obj.browse(cr, uid, emp_id[0], context=context) if emp.product_id: return emp.product_id.id return False @@ -91,7 +91,7 @@ class hr_analytic_timesheet(osv.osv): context = {} emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context) if emp_id: - emp=emp_obj.browse(cr, uid, emp_id[0], context=context) + emp = emp_obj.browse(cr, uid, emp_id[0], context=context) if emp.product_id: return emp.product_id.uom_id.id return False @@ -104,7 +104,7 @@ class hr_analytic_timesheet(osv.osv): if emp_id: emp = emp_obj.browse(cr, uid, emp_id[0], context=context) if bool(emp.product_id): - a = emp.product_id.product_tmpl_id.property_account_expense.id + a = emp.product_id.product_tmpl_id.property_account_expense.id if not a: a = emp.product_id.categ_id.property_account_expense_categ.id if a: @@ -159,12 +159,14 @@ class hr_analytic_timesheet(osv.osv): def on_change_user_id(self, cr, uid, ids, user_id): if not user_id: return {} + context = {'user_id': user_id} return {'value' : { - 'product_id' : self._getEmployeeProduct(cr,user_id, context= {}), - 'product_uom_id' : self._getEmployeeUnit(cr, user_id, context= {}), - 'general_account_id' :self. _getGeneralAccount(cr, user_id, context= {}), - 'journal_id' : self._getAnalyticJournal(cr, user_id, context= {}), + 'product_id' : self._getEmployeeProduct(cr, uid, context), + 'product_uom_id' : self._getEmployeeUnit(cr, uid, context), + 'general_account_id' :self._getGeneralAccount(cr, uid, context), + 'journal_id' : self._getAnalyticJournal(cr, uid, context), }} + hr_analytic_timesheet() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: