[FIX] hr_holidays: update _check_holidays constrains
It was possible to edit a leave request in order to use a leave type which had no more days left. This was due to a missing field in the constrains call. Closes #24320
This commit is contained in:
committed by
RomainLibert
parent
0dd08bd148
commit
4d88e8e822
@@ -248,7 +248,7 @@ class Holidays(models.Model):
|
||||
if nholidays:
|
||||
raise ValidationError(_('You can not have 2 leaves that overlaps on same day!'))
|
||||
|
||||
@api.constrains('state', 'number_of_days_temp')
|
||||
@api.constrains('state', 'number_of_days_temp', 'holiday_status_id')
|
||||
def _check_holidays(self):
|
||||
for holiday in self:
|
||||
if holiday.holiday_type != 'employee' or holiday.type != 'remove' or not holiday.employee_id or holiday.holiday_status_id.limit:
|
||||
|
||||
Reference in New Issue
Block a user