From 9726640a31b6b4dc4c862a942852c892b1c8bb32 Mon Sep 17 00:00:00 2001 From: Dario Del Zozzo Date: Thu, 16 Feb 2023 12:51:02 +0100 Subject: [PATCH] [FIX] hr_holidays_public: fixed action_validate() override --- hr_holidays_public/models/hr_leave.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hr_holidays_public/models/hr_leave.py b/hr_holidays_public/models/hr_leave.py index 32a50f35..5080a2e6 100644 --- a/hr_holidays_public/models/hr_leave.py +++ b/hr_holidays_public/models/hr_leave.py @@ -15,11 +15,16 @@ def action_validate(self): holiday. Unfortunately, no regression test can be added, being in a separate module. """ - if self.holiday_status_id.exclude_public_holidays or not self.holiday_status_id: - self = self.with_context( - employee_id=self.employee_id.id, exclude_public_holidays=True - ) - return super().action_validate() + for leave in self: + if ( + leave.holiday_status_id.exclude_public_holidays + or not leave.holiday_status_id + ): + leave = leave.with_context( + employee_id=leave.employee_id.id, exclude_public_holidays=True + ) + super(HrLeave, leave).action_validate() + return True def _get_duration(self, check_leave_type=True, resource_calendar=None): if self.holiday_status_id.exclude_public_holidays or not self.holiday_status_id: