[FIX] resource: showing only company working hours for public holidays

Stepts to reproduce:

Go to Time-off app > configuration > Public Holidays.
Try to create a new holiday and select working hours.

Issue:

It will show up all the working hours available for all companies even
if we are not in that company at the moment.

Solution:

We need to take into account the company for this field in order to only
show the working hours available for this specific company. I've added
to the field the `domain="[('company_id', 'in', [company_id, False])]"`
in order to follow the same behavior as next versions.

This issue affects 15.0 and saas-15.2

opw-3068827

closes odoo/odoo#106981

X-original-commit: 65f2861bf2728a7f9f991c47edc77fc557dfde14
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Maruan Aguerdouh (magm)
2022-12-01 17:32:28 +01:00
parent 4044bc9335
commit 30d8cfdf0e
+1 -1
View File
@@ -1123,7 +1123,7 @@ class ResourceCalendarLeaves(models.Model):
company_id = fields.Many2one(
'res.company', string="Company", readonly=True, store=True,
default=lambda self: self.env.company, compute='_compute_company_id')
calendar_id = fields.Many2one('resource.calendar', 'Working Hours', domain="[('company_id', '=', company_id)]", index=True)
calendar_id = fields.Many2one('resource.calendar', 'Working Hours', domain="[('company_id', 'in', [company_id, False])]", check_company=True, index=True)
date_from = fields.Datetime('Start Date', required=True)
date_to = fields.Datetime('End Date', required=True)
resource_id = fields.Many2one(