[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) <sgv@odoo.com>
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
sofiagvaladze
2023-11-08 04:09:45 +00:00
parent 81675e9400
commit 755a3aae1b
+1 -1
View File
@@ -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,