From 9b7c74cadc7e477bf8d6fe2f5899ac61eb18e882 Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Mon, 17 Apr 2023 12:09:52 +0000 Subject: [PATCH] [FIX] hr_holidays: correct condition with requires allocation The field `requires_allocation` is a selection field that is required. Using it in an if statement without a comparison operation will always return true. opw-3274826 closes odoo/odoo#118854 X-original-commit: 486498ddf1d29c7fc58107e83421686ace30ff4f Signed-off-by: Kevin Baptiste Signed-off-by: Lefebvre Thomas (thle) --- addons/hr_holidays/models/hr_leave_type.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr_leave_type.py b/addons/hr_holidays/models/hr_leave_type.py index 758eb3b1719..31921a676a3 100644 --- a/addons/hr_holidays/models/hr_leave_type.py +++ b/addons/hr_holidays/models/hr_leave_type.py @@ -141,7 +141,7 @@ class HolidaysType(models.Model): date_from = self._context.get('default_date_from', fields.Datetime.today()) employee_id = self._context.get('default_employee_id', self._context.get('employee_id', self.env.user.employee_id.id)) for holiday_type in self: - if holiday_type.requires_allocation: + if holiday_type.requires_allocation == 'yes': allocation = self.env['hr.leave.allocation'].search([ ('holiday_status_id', '=', holiday_type.id), ('employee_id', '=', employee_id),