From 101fef18ee76e34f2164f0f17e2292b58508c742 Mon Sep 17 00:00:00 2001 From: sbel-odoo Date: Tue, 19 Dec 2023 11:42:11 +0100 Subject: [PATCH] [FIX] resource: enable changing company in working times MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently when trying to change the company in the configuration of a working times, a traceback error occurs. Steps to reproduce: ------------------- * Select app ´Employees´ * Select ´Configuration´ -> ´Working Times´ * Select any * Try changing the ´Company´ field Why the fix: ------------ Result of [False, self.env.companies.ids]: [False, [1]] opw-3634123 closes odoo/odoo#148344 X-original-commit: 85bc53984b97e98ab8fe2cf966e32c0146891a88 Signed-off-by: Bertrand Dossogne (bedo) Signed-off-by: Sarah Bellefroid (sbel) --- addons/resource/models/resource_calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/resource/models/resource_calendar.py b/addons/resource/models/resource_calendar.py index dc5f2bb0ec4..7d653084c1e 100644 --- a/addons/resource/models/resource_calendar.py +++ b/addons/resource/models/resource_calendar.py @@ -80,7 +80,7 @@ class ResourceCalendar(models.Model): active = fields.Boolean("Active", default=True, help="If the active field is set to false, it will allow you to hide the Working Time without removing it.") company_id = fields.Many2one( - 'res.company', 'Company', domain=lambda self: [('id', 'in', [False, self.env.companies.ids])], + 'res.company', 'Company', domain=lambda self: [('id', 'in', self.env.companies.ids)], default=lambda self: self.env.company) attendance_ids = fields.One2many( 'resource.calendar.attendance', 'calendar_id', 'Working Time',