diff options
| author | Lucas Lefèvre <lul@odoo.com> | 2020-01-15 14:59:13 +0100 |
|---|---|---|
| committer | Lucas Lefèvre <lul@odoo.com> | 2020-04-09 10:59:33 +0200 |
| commit | ae3d37c201bb1e5064096c6fc13e9db18e566611 (patch) | |
| tree | 9fc2fbec68f299015da25897724b250940ea1848 /addons/google_calendar/views | |
| parent | 85907951c52b40c6dfdaeffa68ce43ccc8bfe0f5 (diff) | |
[REF] google_calendar: Refactor synchronisation
This commit refactors calendar synchronization between Odoo and Google after the
main calendar application refactoring.
This refactoring takes advantage of two new features from the Google API:
- New way of synchronizing resources efficiently[1]
Incremental sync is performed repeatedly and updates Odoo with all the changes that
happened ever since the previous sync. Each time, Odoo provides the previous sync
token it obtained from Google and stores the new sync token from the response.
- Event metadata[2]
Ability to set hidden key-value pairs with an event, called extended properties.
These extended properties are used to store the related odoo event id and the Odoo
owner id (see known limitations)
Known limitations
=================
- Let A and B be two new users (no tokens available). A creates an event in Odoo and
invites B. A is the owner of the event (user_id). Now B authenticates to his Google Calendar
account and synchronizes his calendar. We cannot send the event to A's calendar since we
don't have any access to his Google Calendar. Hence the event his sent to B's calendar.
This leads to data de-synchronisation: The owner is A in Odoo but B in Google.
The "real" owner (user A) is stored in the Google event's metadata to be able to
reconcile the owner for following synchronizations.
- Let A and B be two users of Odoo and Google Calendar. And let the Google Calendar of B
be private (e.g. if A creates an event in Google Calendar and invites B, B won't see the
event in his calendar). If A creates an event in Odoo and invites B. The event is synced
to Google Calendar of A. Now B can see the event in Odoo but he can't see it in his
Google Calendar.
Task 2126717
PR #42031
PR Enterprise odoo/enterprise#8006
[1] https://developers.google.com/calendar/v3/sync
[2] https://developers.google.com/calendar/extended-properties
Diffstat (limited to 'addons/google_calendar/views')
| -rw-r--r-- | addons/google_calendar/views/calendar_event_views.xml | 13 | ||||
| -rw-r--r-- | addons/google_calendar/views/google_calendar_templates.xml | 7 | ||||
| -rw-r--r-- | addons/google_calendar/views/res_users_views.xml | 4 |
3 files changed, 22 insertions, 2 deletions
diff --git a/addons/google_calendar/views/calendar_event_views.xml b/addons/google_calendar/views/calendar_event_views.xml new file mode 100644 index 00000000000..0f787832525 --- /dev/null +++ b/addons/google_calendar/views/calendar_event_views.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record id="calendar_event_view_calendar" model="ir.ui.view"> + <field name="name">calendar.event.view.calendar.inherit</field> + <field name="model">calendar.event</field> + <field name="inherit_id" ref="calendar.view_calendar_event_calendar"/> + <field name="arch" type="xml"> + <xpath expr="//calendar" position="attributes"> + <attribute name="js_class">google_sync_calendar</attribute> + </xpath> + </field> + </record> +</odoo>
\ No newline at end of file diff --git a/addons/google_calendar/views/google_calendar_templates.xml b/addons/google_calendar/views/google_calendar_templates.xml index 1448a2dedde..3b79f6a5a1e 100644 --- a/addons/google_calendar/views/google_calendar_templates.xml +++ b/addons/google_calendar/views/google_calendar_templates.xml @@ -9,7 +9,14 @@ <template id="qunit_suite" name="google_calendar_tests" inherit_id="web.qunit_suite_tests"> <xpath expr="." position="inside"> + <script type="text/javascript" src="/google_calendar/static/tests/mock_server.js" /> <script type="text/javascript" src="/google_calendar/static/tests/google_calendar_tests.js"></script> </xpath> </template> + + <template id="qunit_mobile_suite" name="mail_mobile_tests" inherit_id="web.qunit_mobile_suite_tests"> + <xpath expr="." position="inside"> + <script type="text/javascript" src="/google_calendar/static/tests/mock_server.js" /> + </xpath> + </template> </odoo> diff --git a/addons/google_calendar/views/res_users_views.xml b/addons/google_calendar/views/res_users_views.xml index bc4a1d0e9ab..5fd1d71efbc 100644 --- a/addons/google_calendar/views/res_users_views.xml +++ b/addons/google_calendar/views/res_users_views.xml @@ -7,12 +7,12 @@ <field name="inherit_id" ref="base.view_users_form"/> <field name="arch" type="xml"> <notebook colspan="4" position="inside"> - <page string="Calendar" name="calendar"> + <page string="Calendar" name="calendar" groups="base.group_system"> <group> <field name="google_calendar_rtoken"/> <field name="google_calendar_token"/> <field name="google_calendar_token_validity"/> - <field name="google_calendar_last_sync_date"/> + <field name="google_calendar_sync_token"/> <field name="google_calendar_cal_id"/> </group> </page> |
