diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index bd71f6479bd..a28508be4db 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -137,11 +137,13 @@ class hr_analytic_timesheet(osv.osv): if context is None: 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) - if emp.journal_id: - return emp.journal_id.id - return False + if not emp_id : + raise osv.except_osv(_('Warning!'), _('Please create an employee for this user, using the menu: Human Resources > Employees.')) + emp = emp_obj.browse(cr, uid, emp_id[0], context=context) + if emp.journal_id: + return emp.journal_id.id + else : + raise osv.except_osv(_('Warning!'), _('No analytic journal defined for \'%s\'.\nYou should assign an analytic journal on the employee form.')%(emp.name)) _defaults = { diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 5dd71eadd1b..52d2cfa9d14 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -46,7 +46,7 @@
-