From de7d7a71ea6ed2543afe5e5354e5a1cde5f4c255 Mon Sep 17 00:00:00 2001 From: Kevin Baptiste Date: Mon, 3 Apr 2023 14:24:26 +0000 Subject: [PATCH] [IMP] resource: show only company's calendars To avoid any misconfiguration, only the current companies' calendars are shown and not all the resource.calendar. task-3254874 closes odoo/odoo#117663 Related: odoo/enterprise#39311 Signed-off-by: Kevin Baptiste --- addons/resource/models/resource_calendar.py | 2 +- addons/resource/views/resource_calendar_views.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/resource/models/resource_calendar.py b/addons/resource/models/resource_calendar.py index 7627d9fc0b5..0e31849f657 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', + 'res.company', 'Company', domain=lambda self: [('id', 'in', [False, self.env.companies.ids])], default=lambda self: self.env.company) attendance_ids = fields.One2many( 'resource.calendar.attendance', 'calendar_id', 'Working Time', diff --git a/addons/resource/views/resource_calendar_views.xml b/addons/resource/views/resource_calendar_views.xml index 41ea09b15ff..53b5f52c312 100644 --- a/addons/resource/views/resource_calendar_views.xml +++ b/addons/resource/views/resource_calendar_views.xml @@ -73,6 +73,7 @@ Working Times resource.calendar tree,form + ['|', ('company_id', '=', False), ('company_id', 'in', allowed_company_ids)]