HR_TIMESHEET: better fix for employee without product
bzr revid: ced-2388990551e11d22f51d379ba2cd66fd0243031a
This commit is contained in:
parent
617c86ad20
commit
556147053b
|
@ -64,7 +64,9 @@ class hr_analytic_timesheet(osv.osv):
|
||||||
emp_obj = self.pool.get('hr.employee')
|
emp_obj = self.pool.get('hr.employee')
|
||||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||||
if emp_id:
|
if emp_id:
|
||||||
return emp_obj.browse(cr, uid, emp_id[0], context).product_id.id
|
emp=emp_obj.browse(cr, uid, emp_id[0], context)
|
||||||
|
if emp.product_id:
|
||||||
|
return emp.product_id.id
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _getEmployeeUnit(self, cr, uid, context):
|
def _getEmployeeUnit(self, cr, uid, context):
|
||||||
|
@ -72,9 +74,8 @@ class hr_analytic_timesheet(osv.osv):
|
||||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||||
if emp_id:
|
if emp_id:
|
||||||
emp=emp_obj.browse(cr, uid, emp_id[0], context)
|
emp=emp_obj.browse(cr, uid, emp_id[0], context)
|
||||||
if not emp.product_id:
|
if emp.product_id:
|
||||||
raise osv.except_osv('No product !', "The employee haven't an associated product")
|
return emp.product_id.uom_id.id
|
||||||
return emp.product_id.uom_id.id
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _getGeneralAccount(self, cr, uid, context):
|
def _getGeneralAccount(self, cr, uid, context):
|
||||||
|
|
Loading…
Reference in New Issue