From 617c86ad20fe8623a09f32a745e18560a8578531 Mon Sep 17 00:00:00 2001 From: ced <> Date: Thu, 21 Dec 2006 07:42:18 +0000 Subject: [PATCH] HR_TIMESHEET: add exception if employee haven't product bzr revid: ced-c656f5b534e1cacd27ba512e39a6bc338e6f345c --- addons/hr_timesheet/hr_timesheet.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index cd223049608..1124aa7afbb 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -71,7 +71,10 @@ class hr_analytic_timesheet(osv.osv): emp_obj = self.pool.get('hr.employee') emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)]) if emp_id: - return emp_obj.browse(cr, uid, emp_id[0], context).product_id.uom_id.id + emp=emp_obj.browse(cr, uid, emp_id[0], context) + if not emp.product_id: + raise osv.except_osv('No product !', "The employee haven't an associated product") + return emp.product_id.uom_id.id return False def _getGeneralAccount(self, cr, uid, context):