[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#123040 X-original-commit: 2d2d3388df7ffe0243d13d5b922b5ba6776a434d Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user