[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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user