Skip to content
Snippets Groups Projects
user avatar
Adrien Widart authored
Suppose Google Calendar synced with Odoo. When the user updates a
recurrent event on Google, syncing with Odoo may cancel the change.

To reproduce the error:
(Need google_calendar)
1. [On Google Calendar] Create a recurrent event
2. Sync with Google Calendar
3. [On Google Calendar] Move one of the recurrent events
    - Its date must be different
4. Sync with Google Calendar

Error: The updated event didn't move. On Google Calendar, the event has
moved to its initial date.

At some point, when updating a recurrent event that has moved, the
method `detach_recurring_event` is called. This method is in charge of
getting all data before creating the moved event. However, to get all
data, it first calls the `read` method and then adds some other
information:
https://github.com/odoo/odoo/blob/acaca80f0ce544d1c9a738a5aac992a8ac9c75b2/addons/calendar/models/calendar.py#L1409-L1420


And here is the problem. The method `read` provides additional
information, such as `start_datetime` and `stop_datetime`. However,
theses fields are computed based on the *calendar_id* of the event. Such
an identifier is like `<ID>-<Date>` where *Date* is the initial date of
the event. Therefore, `start`, `stop`, `start_datetime`, ... will be
incorrect.
Back to `detach_recurring_event`, `data` will be updated with some other
values and with `values`. Hopefully, since the latter contains the new
start and stop dates, `start` and `stop` will be overwrote with correct
values (i.e., dates of the moved event). However, `start_datetime` and
`stop_datetime` are still present and incorrect.
Therefore, because of the presence of these two variables, the method
`_inverse_dates` is triggered on creation of the new event. This one
recomputes `start` and `stop` based on `start_datetime` and
`stop_datetime`, but theses fields are incorrect (they are equal to
intial start and stop dates). This is the reason why (1) the updated
event didn't move and thus (2) on Google Calendar, the event has moved
back to its initial date.
This fix suggests to remove several fields from `read` method, because
some undesirable behaviors may happen. Moreover, since these fields are
computable, it's easy to get their (correct) value.

OPW-2474721

closes odoo/odoo#69150

Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
7b458ce7
History

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials