[FIX] calendar: handle singleton exception for sync calendar event

This error occurs when recurrence_id has no records when the user tries to
delete the sync calendar which has recurrent events.

Error: 'Expected singleton: calendar.recurrence()'

See-
https://github.com/odoo/odoo/blob/15.0/addons/calendar/models/calendar_event.py#L715

sentry-4367276387

closes odoo/odoo#134438

X-original-commit: 6ba4a671c4b37120146f137f88363dd5b170562f
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
This commit is contained in:
Maitri Patel
2023-09-06 13:25:36 +00:00
parent b132c7c6e0
commit b0bc3d0814
+1 -1
View File
@@ -900,7 +900,7 @@ class Meeting(models.Model):
self.ensure_one()
if recurrence_update_setting == 'all_events':
self.recurrence_id.calendar_event_ids.write({'active': False})
elif recurrence_update_setting == 'future_events':
elif recurrence_update_setting == 'future_events' and self.recurrence_id:
detached_events = self.recurrence_id._stop_at(self)
detached_events.write({'active': False})
elif recurrence_update_setting == 'self_only':