[FIX] microsoft_calendar: validation error creating events from microsoft

Before this commit, for some synced users, a weird behavior was happening when an event was created in Microsoft: the event info was being sent to Odoo with a different organizer than 'self.env.user' even though it was the same user creating the event.

After this commit, a condition checking if the event was created in Microsoft is added for skipping the checking since only events created in Odoo can have different organizers during their creation.

Issue from: 3450045

closes odoo/odoo#141481

X-original-commit: 176ca9789b0c2e032773f3ba2c72ab7e2ed24d91
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Gabriel de Paula Felix (gdpf) <gdpf@odoo.com>
This commit is contained in:
Gabriel de Paula Felix (gdpf)
2023-11-13 19:03:30 +00:00
parent 8c19636fd7
commit 1bcc41f7fe
@@ -415,7 +415,7 @@ class MicrosoftSync(models.AbstractModel):
if token:
self._ensure_attendees_have_email()
res = microsoft_service.patch(event_id, values, token=token, timeout=timeout)
self.write({
self.with_context(dont_notify=True).write({
'need_sync_m': not res,
})