[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) <sgv@odoo.com>
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Dawn Hwang
2023-07-20 10:07:05 +02:00
committed by sofiagvaladze
parent 0c405014d2
commit 7fca358b7f
+2 -1
View File
@@ -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: