Commit Graph
6 Commits
Author SHA1 Message Date
Arnaud Joset f7d16b4599 [IMP] microsoft_calendar: apply the google_calendar improvements into this module
Several imrovements have been made in google_calendar that affets the efficiency of the sync and the validity of the synched data
This commit apply the more relevant modifications to this module.

Taskid: 2484335
Part-of: odoo/odoo#68700
2021-08-26 10:21:02 +00:00
Adrien Widart 28818c46ed [FIX] microsoft_calendar: archive cancelled recurrence occurrence
Suppose a recurrent event synced with both calendars. Suppose that the
current user is not the organizer. If one occurrence of the event is
cancelled, the user won't be able to sync the calendars.

To reproduce the event:
(Need two Microsoft accounts A01 and A02)
1. [On Microsoft, with A01] Create an event:
    - Recurrent (next 3 days for instance)
    - With A02
2. Set the address mail of current partner with A02's address
3. Sync with Microsoft
    - Note that the 3 occurrences are displayed
4. [On Microsoft, with A01] Cancel one occurrence
5. Sync calendars

Error: A Validation Error is raised: "The operation cannot be completed:
- Create/update: a mandatory field is not set [...]"

At some point, the module updates each occurrence of the event and
stores the occurrence's values:
https://github.com/odoo/odoo/blob/4ae90dd6f9e28e6fdff45c7612a3a756665e1489/addons/microsoft_calendar/models/microsoft_sync.py#L213-L220
However, the cancelled occurrence will be incorrectly stored. Because it
is cancelled, `_microsoft_to_odoo_values` will return {'active': False}:
https://github.com/odoo/odoo/blob/4ae90dd6f9e28e6fdff45c7612a3a756665e1489/addons/microsoft_calendar/models/calendar.py#L63-L65
Therefore, in the previous code, `values` will contain `(<Recurrence
ID>, None, None)`

Later, when applying the recurrence, the module detects all
already-existing occurrences and the others (i.e., those that need to be
created):
https://github.com/odoo/odoo/blob/02886f65e9026e1f7617c8b23c3d87edd358b168/addons/calendar/models/calendar_recurrence.py#L190-L192
where the ranges are tuples like `(<start of the occurrence>, <end>)`.
As a result, `ranges_to_create` will contain such a tuple `(None, None)`
which makes no sense

OPW-2571398

closes odoo/odoo#74052

X-original-commit: ccad42575ae32d7e8ffe72226cbfed2284e0326e
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-07-20 15:49:01 +00:00
Adrien Widart 642f72bfcc [FIX] microsoft_calendar: warn user if attendee without email
When syncing both Odoo and Outlook Calendar, if one Odoo event has an
attendee who does not have any email adress, it will lead to a traceback
error.

To reproduce the error:
1. Create a partner P who does not have an email address
2. In Calendar, create an event E with P
3. Sync with Outlook

Error: An Odoo Error is raised. When syncing from Outlook to Odoo, it
also sync the E-event (in case the latter has been updated on Outlook).
The Microsoft2Odoo syncing uses the email address of each attendee.
Since P does not have any, this creates the error.

Although Odoo allows the use of participants without email, this is not
the case for Outlook. On Outlook Calendar, as soon as a user adds an
attendee to an Event, Outlook will want to send an invitation before
saving this event (so, if the participant does not have any email
address, it won't be possible to save the event).

When syncing, the E-event will be added to Outlook Calendar. However,
for the same reasons as in the previous paragraph, it will not be
possible to update this event from Outlook Calendar.

Therefore, the solution is to prevent the user from having attendees
without email when his calendar is synchronized with Outlook.

OPW-2439027

closes odoo/odoo#68407

X-original-commit: dbb65f3abfbc7d6e3d8167839659eac79b1e6b31
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-03-26 14:13:15 +00:00
Aurélien (avd) 005741e509 [IMP] microsoft_calendar: add stop synchronization button
Add the possibility to stop/restart the synchronization with
Outlook calendar.

Change the calendar event popover in the calendar view to
display an Archive button if event synced at least once.

Add some tests for the new stop/restart feature.

(PS: this is essentially the same commit as the one for the
google_calendar module except for the JS popover and python
tests).
2020-12-10 10:23:10 +01:00
Raphael Collet 1398b6b44c [IMP] tests: deprecate SavepointCase
closes odoo/odoo#62031

Related: odoo/enterprise#14872
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-11-24 13:23:32 +00:00
jbm-odoo 9dc3057e8e [ADD] calendar_microsoft: Synchronize Microsoft calendar with Odoo
TaskID 2223219

closes odoo/odoo#54936

Related: odoo/upgrade#1557
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-05 13:47:42 +00:00