Skip to content
Snippets Groups Projects
Commit fa0aa292 authored by pedrambiria's avatar pedrambiria Committed by Pedram (PEBR)
Browse files

[FIX] microsoft_calendar: delete events correctly when reseting account


Before this commit, if you reset your microsoft callendar account and
set to remove events from Odoo, it won't remove them. The problem is
that the ('ms_universal_event_id', '!=', False) condition is not
implemented, and it can't remove the existing events.

opw-3382445

closes odoo/odoo#126674

X-original-commit: c4d8530c
Signed-off-by: default avatarArnaud Joset (arj) <arj@odoo.com>
Signed-off-by: default avatarPedram Bi Ria (pebr) <pebr@odoo.com>
parent ae4e82f5
No related branches found
No related tags found
No related merge requests found
......@@ -133,6 +133,12 @@ class MicrosoftSync(models.AbstractModel):
if with_uid
else [('microsoft_id', '=', False)]
)
elif operator == '!=' and not value:
return (
[('microsoft_id', 'ilike', f'{IDS_SEPARATOR}_')]
if with_uid
else [('microsoft_id', '!=', False)]
)
return (
['|'] * (len(value) - 1) + [_domain(v) for v in value]
if operator.lower() == 'in'
......
......@@ -288,3 +288,17 @@ class TestMicrosoftEvent(TestCommon):
# assert
self.assertEqual(len(matched._events), 0)
def test_search_set_ms_universal_event_id(self):
not_synced_events = self.env['calendar.event'].search([('ms_universal_event_id', '=', False)])
synced_events = self.env['calendar.event'].search([('ms_universal_event_id', '!=', False)])
self.assertIn(self.simple_event, synced_events)
self.assertNotIn(self.simple_event, not_synced_events)
self.simple_event.ms_universal_event_id = ''
not_synced_events = self.env['calendar.event'].search([('ms_universal_event_id', '=', False)])
synced_events = self.env['calendar.event'].search([('ms_universal_event_id', '!=', False)])
self.assertNotIn(self.simple_event, synced_events)
self.assertIn(self.simple_event, not_synced_events)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment