From 755a3aae1b9c299c45b01ce2773d9d9bb142208a Mon Sep 17 00:00:00 2001 From: sofiagvaladze Date: Mon, 14 Aug 2023 13:43:39 +0200 Subject: [PATCH] [FIX] resource: do not update attendance_ids when there is no company On the 'resource.calendar', attendance_ids is a computed field and computation is triggered when company_id is changed. Now, if we remove company_id, attendance_ids are left empty. Instead, attendance_ids should be updated only when there is a new company set. task - 3451264 closes odoo/odoo#141433 X-original-commit: af3bff0c578fdbd47a3584cf9e25f3e558cdefc0 Signed-off-by: Sofie Gvaladze (sgv) Signed-off-by: Yannick Tivisse (yti) --- 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 45fe7c437b3..3b480098485 100644 --- a/addons/resource/models/resource_calendar.py +++ b/addons/resource/models/resource_calendar.py @@ -110,7 +110,7 @@ class ResourceCalendar(models.Model): @api.depends('company_id') def _compute_attendance_ids(self): - for calendar in self.filtered(lambda c: not c._origin or c._origin.company_id != c.company_id): + for calendar in self.filtered(lambda c: not c._origin or c._origin.company_id != c.company_id and c.company_id): company_calendar = calendar.company_id.resource_calendar_id calendar.update({ 'two_weeks_calendar': company_calendar.two_weeks_calendar,