19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-25 12:00:11 +01:00
parent e1d89e11e3
commit a1f02d8cc7
225 changed files with 2335 additions and 775 deletions

View file

@ -910,9 +910,11 @@ Versions:
if any(leave.state == 'cancel' for leave in self):
raise UserError(_('Only a manager can modify a canceled leave.'))
# Unlink existing resource.calendar.leaves for validated time off
if 'state' in values and values['state'] != 'validate':
validated_leaves = self.filtered(lambda l: l.state == 'validate')
# If a leave changes state from validated or if the dates of a validated leave change
# unlink the corresponding resource calendar leave
date_fields = {'date_from', 'date_to', 'request_date_from', 'request_date_to'}
validated_leaves = self.filtered(lambda l: l.state == 'validate')
if validated_leaves and (('state' in values and values['state'] != 'validate') or date_fields.intersection(values)):
validated_leaves._remove_resource_leave()
employee_id = values.get('employee_id', False)