[FIX] calendar,google_calendar: exclusions not propagating
Activate Google Synchronization, create on GC a recurrent event, synchronize OE, then delete an event of the recursion on GC, sync again on OE. The event will be deleted from GC but not from OE after sync. The exclusion on OE is not correctly working in that particular case, fixing require also to "suppress" the attendee to avoid that just created exclusions would be detected as changes to send in a following synchronization. closes odoo/odoo#37884 closes odoo/odoo#39510 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -1033,6 +1033,9 @@ class Meeting(models.Model):
|
||||
'event_id': meeting.id,
|
||||
}
|
||||
|
||||
if self._context.get('google_internal_event_id', False):
|
||||
values['google_internal_event_id'] = self._context.get('google_internal_event_id')
|
||||
|
||||
# current user don't have to accept his own meeting
|
||||
if partner == self.env.user.partner_id:
|
||||
values['state'] = 'accepted'
|
||||
|
||||
@@ -20,7 +20,10 @@ class Meeting(models.Model):
|
||||
def write(self, values):
|
||||
sync_fields = set(self.get_fields_need_update_google())
|
||||
if (set(values) and sync_fields) and 'oe_update_date' not in values and 'NewMeeting' not in self._context:
|
||||
values['oe_update_date'] = fields.Datetime.now()
|
||||
if 'oe_update_date' in self._context:
|
||||
values['oe_update_date'] = self._context.get('oe_update_date')
|
||||
else:
|
||||
values['oe_update_date'] = fields.Datetime.now()
|
||||
return super(Meeting, self).write(values)
|
||||
|
||||
@api.returns('self', lambda value: value.id)
|
||||
|
||||
@@ -850,6 +850,14 @@ class GoogleCalendar(models.AbstractModel):
|
||||
parent_oe_id = event_to_synchronize[base_event][0][1].OE.event_id
|
||||
if parent_oe_id:
|
||||
CalendarEvent.browse("%s-%s" % (parent_oe_id, new_google_event_id)).with_context(curr_attendee=event.OE.attendee_id).unlink(can_be_deleted=True)
|
||||
else:
|
||||
main_att = CalendarAttendee.with_context(context_novirtual).search([('partner_id', '=', my_partner_id), ('google_internal_event_id', '=', event.GG.event['id'].rsplit('_', 1)[0])], limit=1)
|
||||
if main_att:
|
||||
excluded_event_id = str(main_att.event_id.id) + '-' + new_google_event_id
|
||||
|
||||
CalendarEvent.browse(excluded_event_id).with_context(google_internal_event_id=event.GG.event.get('id'), oe_update_date=False).unlink(can_be_deleted=False)
|
||||
else:
|
||||
_logger.warning("Could not create the correct exclusion for event")
|
||||
|
||||
elif isinstance(actToDo, Delete):
|
||||
if actSrc == 'GG':
|
||||
|
||||
Reference in New Issue
Block a user