[FIX] microsoft_calendar: ensure syncronization with cancelled event
This commit addresses a synchronization issue with Microsoft Calendar, which arose after the implementation of commit d9c4043. The mentioned commit added tracking to the pre-commit process, inadvertently causing problems during calendar synchronization. The issue surfaced when the `_message_track_post_template` function was called in the pre-commit phase. If the appointment function was installed, the `_track_template` was overridden in this module, leading to an attempt to access the removed event, which raised an error and prevented calendar synchronization. With this modification, the `_track_template` will not be called for the created event that was cancelled in the same transaction. opw-3635261 closes odoo/odoo#148439 X-original-commit: f46276590f62bc578aab954a88e495519b46a07a Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
This commit is contained in:
@@ -638,6 +638,9 @@ class Meeting(models.Model):
|
||||
"""
|
||||
user = self.env.user
|
||||
records = self.filtered(lambda e: not e.user_id or e.user_id == user or user.partner_id in e.partner_ids)
|
||||
for event in records:
|
||||
# remove the tracking data to avoid calling _track_template in the pre-commit phase
|
||||
self.env.cr.precommit.data.pop(f'mail.tracking.create.{event._name}.{event.id}', None)
|
||||
super(Meeting, records)._cancel_microsoft()
|
||||
attendees = (self - records).attendee_ids.filtered(lambda a: a.partner_id == user.partner_id)
|
||||
attendees.do_decline()
|
||||
|
||||
Reference in New Issue
Block a user