Skip to content
Snippets Groups Projects
Commit 2d2d3388 authored by Thomas Lefebvre (thle)'s avatar Thomas Lefebvre (thle)
Browse files

[FIX] hr_holidays: public holidays affect other companies


Issue:
------
In a multi-company context, the creation of a public holiday
in one company will affect leaves in other companies.
We cancel leaves that have the same time slot as the
public holiday, regardless of the company.

Solution:
---------
Take account of the company in which
the public holiday is created and compare
it with the company of the employee who has leave.

opw-3339973

closes odoo/odoo#122896

Signed-off-by: default avatarKevin Baptiste <kba@odoo.com>
parent 90190314
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ class CalendarLeaves(models.Model):
domain = []
for date in time_domain_dict:
domain = expression.OR([domain, [
('employee_company_id', '=', date['company_id']),
('date_to', '>', date['date_from']),
('date_from', '<', date['date_to'])]
])
......@@ -43,6 +44,7 @@ class CalendarLeaves(models.Model):
def _get_time_domain_dict(self):
return [{
'company_id' : record.company_id.id,
'date_from' : record.date_from,
'date_to' : record.date_to
} for record in self if not record.resource_id]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment