[FIX] hr_timesheet : Onchange of user was counting changed user into context
lp bug: https://launchpad.net/bugs/620907 fixed bzr revid: jvo@tinyerp.com-20100827091739-14m4insilfd8s3xg
This commit is contained in:
parent
6422e808ee
commit
64a2c35fac
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue