From de183583b2f651604aa899237e84be6dcee28c73 Mon Sep 17 00:00:00 2001 From: Arnaud Joset Date: Wed, 22 Sep 2021 07:07:46 +0000 Subject: [PATCH] [FIX] calendar,google_calendar: send correct datetime for events in recurrences. google_calendar: before this commit, the timezone of recurring events was not properly tested. when an recurrence was created in Odoo, the start and stop datetime were incorrectly set before https://github.com/odoo/odoo/pull/76546/commits/182f0cab58dd4e8a8ce1a3af5eaf8c3d8bea51e6. This commit test this behavior. calendar: add recurrence information in mail invitation https://github.com/odoo/odoo/commit/bc9bc2686ca142a7348dc48e0b7f8e74fdd42e10 removed the recurrent template variable that is used to add recurrence information in the mail invitation. FW port of https://github.com/odoo/odoo/pull/76546 closes odoo/odoo#77559 X-original-commit: e1d1e9ee20e6de4c9b9873e533ff9c89d7b392ef Signed-off-by: Yannick Tivisse (yti) Signed-off-by: Arnaud Joset --- addons/calendar/data/mail_template_data.xml | 3 ++ .../tests/test_sync_odoo2google.py | 37 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/addons/calendar/data/mail_template_data.xml b/addons/calendar/data/mail_template_data.xml index 06d5e107070..8c6a963069d 100644 --- a/addons/calendar/data/mail_template_data.xml +++ b/addons/calendar/data/mail_template_data.xml @@ -16,6 +16,7 @@ +

Hello Wood Corner,

@@ -144,6 +145,8 @@ + +

Hello Ready Mat,

diff --git a/addons/google_calendar/tests/test_sync_odoo2google.py b/addons/google_calendar/tests/test_sync_odoo2google.py index 71d3dabde31..c69dfdeac86 100644 --- a/addons/google_calendar/tests/test_sync_odoo2google.py +++ b/addons/google_calendar/tests/test_sync_odoo2google.py @@ -518,3 +518,40 @@ class TestSyncOdoo2Google(TestSyncGoogle): 'reminders': {'overrides': [], 'useDefault': False}, 'visibility': 'public', }) + + + @patch_api + def test_all_event_with_tz_updated(self): + google_id = 'aaaaaaaaa' + event = self.env['calendar.event'].create({ + 'name': "Event", + 'start': datetime(2020, 1, 15, 8, 0), + 'stop': datetime(2020, 1, 15, 9, 0), + 'need_sync': False, + }) + recurrence = self.env['calendar.recurrence'].create({ + 'google_id': google_id, + 'rrule': 'FREQ=WEEKLY;COUNT=2;BYDAY=WE', + 'base_event_id': event.id, + 'need_sync': False, + }) + recurrence._apply_recurrence() + event.write({ + 'name': 'New name', + 'recurrence_update': 'all_events', + }) + self.assertGoogleEventPatched(recurrence.google_id, { + 'id': recurrence.google_id, + 'start': {'dateTime': "2020-01-15T08:00:00+00:00", 'timeZone': 'Europe/Brussels'}, + 'end': {'dateTime': "2020-01-15T09:00:00+00:00", 'timeZone': 'Europe/Brussels'}, + 'summary': 'New name', + 'description': '', + 'location': '', + 'guestsCanModify': True, + 'organizer': {'email': 'odoobot@example.com', 'self': True}, + 'attendees': [{'email': 'odoobot@example.com', 'responseStatus': 'accepted'}], + 'recurrence': ['RRULE:FREQ=WEEKLY;COUNT=2;BYDAY=WE'], + 'extendedProperties': {'shared': {'%s_odoo_id' % self.env.cr.dbname: recurrence.id}}, + 'reminders': {'overrides': [], 'useDefault': False}, + 'visibility': 'public', + }, timeout=3)