[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
This commit is contained in:
parent
0b7db5583f
commit
dd9d8b0c84
|
@ -298,7 +298,8 @@ class hr_timesheet_line(osv.osv):
|
||||||
for ts_line in self.browse(cursor, user, ids, context=context):
|
for ts_line in self.browse(cursor, user, ids, context=context):
|
||||||
sheet_ids = sheet_obj.search(cursor, user,
|
sheet_ids = sheet_obj.search(cursor, user,
|
||||||
[('date_to', '>=', ts_line.date), ('date_from', '<=', ts_line.date),
|
[('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)
|
context=context)
|
||||||
if sheet_ids:
|
if sheet_ids:
|
||||||
# [0] because only one sheet possible for an employee between 2 dates
|
# [0] because only one sheet possible for an employee between 2 dates
|
||||||
|
|
Loading…
Reference in New Issue