From 4d88e8e8223d04cff05e7f5b4fae2cef081707d9 Mon Sep 17 00:00:00 2001 From: Akim Juillerat Date: Thu, 19 Apr 2018 13:58:42 +0200 Subject: [PATCH] [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 --- addons/hr_holidays/models/hr_holidays.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr_holidays.py b/addons/hr_holidays/models/hr_holidays.py index 469a60f0231..75ac11d3406 100644 --- a/addons/hr_holidays/models/hr_holidays.py +++ b/addons/hr_holidays/models/hr_holidays.py @@ -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: