From dd9d8b0c84fd03c7be5f04f2559e64bccebc7070 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 9 Feb 2015 12:09:24 +0100 Subject: [PATCH] [FIX] hr_timesheet_sheet: prevent new activity on confirmed sheets Once a timesheet confirmed, the activity hours should not be modified, for any reasons. The constraint _check_sheet_state prevents to modify activities for confirmed timesheets, but does not prevent the addition of new activities within the current, but confirmed, timesheet. opw-627415 fixes #5128 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index e312ae87868..c964f0c57b6 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -298,7 +298,8 @@ class hr_timesheet_line(osv.osv): for ts_line in self.browse(cursor, user, ids, context=context): sheet_ids = sheet_obj.search(cursor, user, [('date_to', '>=', ts_line.date), ('date_from', '<=', ts_line.date), - ('employee_id.user_id', '=', ts_line.user_id.id)], + ('employee_id.user_id', '=', ts_line.user_id.id), + ('state', 'in', ['draft', 'new'])], context=context) if sheet_ids: # [0] because only one sheet possible for an employee between 2 dates