From 30d8cfdf0e5bbcbd848769995d564481288a0f52 Mon Sep 17 00:00:00 2001 From: "Maruan Aguerdouh (magm)" Date: Thu, 24 Nov 2022 12:10:36 +0000 Subject: [PATCH] [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) --- addons/resource/models/resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/resource/models/resource.py b/addons/resource/models/resource.py index a9ea086f9f0..2aeb9ed3bef 100644 --- a/addons/resource/models/resource.py +++ b/addons/resource/models/resource.py @@ -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(