From 8847d391e4a1e7a03b87d4d2780d8bd7a94d4ecc Mon Sep 17 00:00:00 2001 From: Arnaud Joset Date: Mon, 10 Jan 2022 15:29:51 +0000 Subject: [PATCH] [FIX] google_calendar: fix attendee deletion When an attendee is deleted in google, we need to sync the odoo attendees and delete the ones that do not exist anymore in google. Unfortunately, by doing so, we introduced an issue. We filtered attendees that were no longer existing when we looped on the attendee emails. ```py odoo.exceptions.MissingError: Record does not exist or has been deleted. (Record: calendar.attendee(YYY,), User: XXX) ``` This commit ensure that we filter only existing attendees. X-original-commit: 0fb1002c9bb027d1694b834c52e4492a03c8a09d Part-of: odoo/odoo#83040 --- addons/google_calendar/models/calendar_recurrence_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/google_calendar/models/calendar_recurrence_rule.py b/addons/google_calendar/models/calendar_recurrence_rule.py index dd435137db6..a3b7266ca64 100644 --- a/addons/google_calendar/models/calendar_recurrence_rule.py +++ b/addons/google_calendar/models/calendar_recurrence_rule.py @@ -109,7 +109,7 @@ class RecurrenceRule(models.Model): for odoo_attendee_email in set(existing_attendees.mapped('email')): # Remove old attendees if email_normalize(odoo_attendee_email) not in emails: - attendee = existing_attendees.filtered(lambda att: att.email == email_normalize(odoo_attendee_email)) + attendee = existing_attendees.exists().filtered(lambda att: att.email == email_normalize(odoo_attendee_email)) self.calendar_event_ids.write({'need_sync': False, 'partner_ids': [(3, attendee.partner_id.id)]}) # Update the recurrence values