From 7fca358b7f23baf92209d52dc48a31002332f2a4 Mon Sep 17 00:00:00 2001 From: Dawn Hwang Date: Tue, 11 Jul 2023 11:29:21 +0000 Subject: [PATCH] [FIX] hr_holidays: Fix domain in _get_number_of_days The domain was forced to fix multi-company rules, but now is missing domain checking whether the resource.calendar.leave is of "leave" type. This is set if the domain is None but since the domain is overridden, it needs to be set explicitly closes odoo/odoo#128993 X-original-commit: 4e91aed5c31114064514f5a9e9c0ab0332580208 Signed-off-by: Sofie Gvaladze (sgv) Signed-off-by: Kevin Baptiste --- addons/hr_holidays/models/hr_leave.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index 9138e3b6591..1b2cae9125c 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -728,7 +728,8 @@ class HolidaysRequest(models.Model): def _get_number_of_days_batch(self, date_from, date_to, employees): """ Returns a float equals to the timedelta between two dates given as string.""" # We force the company in the domain as we are more than likely in a compute_sudo - domain = [('company_id', 'in', self.env.company.ids + self.env.context.get('allowed_company_ids', []))] + domain = [('time_type', '=', 'leave'), + ('company_id', 'in', self.env.company.ids + self.env.context.get('allowed_company_ids', []))] result = employees._get_work_days_data_batch(date_from, date_to, domain=domain) for employee_id in result: