[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) <yti@odoo.com>
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
This commit is contained in:
Arnaud Joset
2021-10-01 10:09:47 +00:00
parent 640fa1d1c3
commit de183583b2
2 changed files with 40 additions and 0 deletions
@@ -16,6 +16,7 @@
<t t-set="customer" t-value=" object.event_id.find_partner_customer()"/>
<t t-set="target_responsible" t-value="object.partner_id == object.event_id.partner_id"/>
<t t-set="target_customer" t-value="object.partner_id == customer"/>
<t t-set="recurrent" t-value="object.recurrence_id and not ctx.get('calendar_template_ignore_recurrence')"/>
<p>
Hello <t t-out="object.common_name or ''">Wood Corner</t>,<br/><br/>
@@ -144,6 +145,8 @@
<t t-set="customer" t-value="object.event_id.find_partner_customer()"/>
<t t-set="target_responsible" t-value="object.partner_id == object.event_id.partner_id"/>
<t t-set="target_customer" t-value="object.partner_id == customer"/>
<t t-set="recurrent" t-value="object.recurrence_id and not ctx.get('calendar_template_ignore_recurrence')"/>
<p>
Hello <t t-out="object.common_name or ''">Ready Mat</t>,<br/><br/>
<t t-if="is_online and target_responsible">
@@ -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)