[FIX] google_calendar: toggle all-day field
Before this commit when we have a synced event with google and then we toggle the all-day field changes didn't reflect on google side This happened because google uses two separate fields for start/end. 1. dateTime (used for normal events) 2. date (used for all-day events) when one of them is set, the other must be null. Before this commit when we did a patch update, we set only one, but forget about the other which raises an error. closes odoo/odoo#157664 Task: 3681668 Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
This commit is contained in:
@@ -279,11 +279,15 @@ class Meeting(models.Model):
|
||||
|
||||
def _google_values(self):
|
||||
if self.allday:
|
||||
start = {'date': self.start_date.isoformat()}
|
||||
end = {'date': (self.stop_date + relativedelta(days=1)).isoformat()}
|
||||
# For all-day events, 'dateTime' must be set to None to indicate that it's an all-day event.
|
||||
# Otherwise, if both 'date' and 'dateTime' are set, Google may not recognize it as an all-day event.
|
||||
start = {'date': self.start_date.isoformat(), 'dateTime': None}
|
||||
end = {'date': (self.stop_date + relativedelta(days=1)).isoformat(), 'dateTime': None}
|
||||
else:
|
||||
start = {'dateTime': pytz.utc.localize(self.start).isoformat()}
|
||||
end = {'dateTime': pytz.utc.localize(self.stop).isoformat()}
|
||||
# For timed events, 'date' must be set to None to indicate that it's not an all-day event.
|
||||
# Otherwise, if both 'date' and 'dateTime' are set, Google may not recognize it as a timed event
|
||||
start = {'dateTime': pytz.utc.localize(self.start).isoformat(), 'date': None}
|
||||
end = {'dateTime': pytz.utc.localize(self.stop).isoformat(), 'date': None}
|
||||
reminders = [{
|
||||
'method': "email" if alarm.alarm_type == "email" else "popup",
|
||||
'minutes': alarm.duration_minutes
|
||||
|
||||
@@ -284,8 +284,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
self.assertGoogleEventPatched(event.google_id, {
|
||||
'id': event.google_id,
|
||||
'summary': 'coucou',
|
||||
'start': {'date': str(event.start_date)},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1))},
|
||||
'start': {'date': str(event.start_date), 'dateTime': None},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1)), 'dateTime': None},
|
||||
'attendees': [{'email': 'odoobot@example.com', 'responseStatus': 'declined'}],
|
||||
'extendedProperties': {'private': {'%s_odoo_id' % self.env.cr.dbname: event.id}},
|
||||
'reminders': {'overrides': [], 'useDefault': False},
|
||||
@@ -416,8 +416,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'visibility': 'public',
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;WKST=SU;COUNT=3;BYDAY=MO'],
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {'dateTime': '2020-01-06T18:00:00+01:00'},
|
||||
'end': {'dateTime': '2020-01-06T19:00:00+01:00'},
|
||||
'start': {'dateTime': '2020-01-06T18:00:00+01:00', 'date': None},
|
||||
'end': {'dateTime': '2020-01-06T19:00:00+01:00', 'date': None},
|
||||
}
|
||||
self.env['calendar.recurrence']._sync_google2odoo(GoogleEvent([values]))
|
||||
recurrence = self.env['calendar.recurrence'].search([('google_id', '=', values.get('id'))])
|
||||
@@ -710,8 +710,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'id': google_id,
|
||||
'summary': 'coucou again',
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;COUNT=3;BYDAY=MO'],
|
||||
'start': {'dateTime': '2021-02-15T09:00:00+01:00'}, # 8:00 UTC
|
||||
'end': {'dateTime': '2021-02-15-T11:00:00+01:00'},
|
||||
'start': {'dateTime': '2021-02-15T09:00:00+01:00', 'date': None}, # 8:00 UTC
|
||||
'end': {'dateTime': '2021-02-15-T11:00:00+01:00', 'date': None},
|
||||
'reminders': {'useDefault': True},
|
||||
"attendees": [
|
||||
{
|
||||
@@ -760,8 +760,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'id': google_id,
|
||||
'summary': "It's me again",
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;COUNT=4;BYDAY=MO'],
|
||||
'start': {'dateTime': '2021-02-15T12:00:00+01:00'}, # 11:00 UTC
|
||||
'end': {'dateTime': '2021-02-15-T15:00:00+01:00'},
|
||||
'start': {'dateTime': '2021-02-15T12:00:00+01:00', 'date': None}, # 11:00 UTC
|
||||
'end': {'dateTime': '2021-02-15-T15:00:00+01:00', 'date': None},
|
||||
'reminders': {'useDefault': True},
|
||||
"attendees": [
|
||||
{
|
||||
@@ -822,8 +822,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'visibility': 'public',
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;WKST=SU;COUNT=3;BYDAY=MO'],
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {'dateTime': '2020-01-06T18:00:00+01:00', 'timeZone': 'Pacific/Auckland'},
|
||||
'end': {'dateTime': '2020-01-06T19:00:00+01:00', 'timeZone': 'Pacific/Auckland'},
|
||||
'start': {'dateTime': '2020-01-06T18:00:00+01:00', 'timeZone': 'Pacific/Auckland', 'date': None},
|
||||
'end': {'dateTime': '2020-01-06T19:00:00+01:00', 'timeZone': 'Pacific/Auckland', 'date': None},
|
||||
}
|
||||
self.env['calendar.recurrence']._sync_google2odoo(GoogleEvent([values]))
|
||||
recurrence = self.env['calendar.recurrence'].search([('google_id', '=', values.get('id'))])
|
||||
@@ -962,11 +962,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2020-01-06T18:00:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2020-01-13T19:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
}
|
||||
self.env['calendar.event']._sync_google2odoo(GoogleEvent([values]))
|
||||
@@ -979,8 +981,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'visibility': 'public',
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;WKST=SU;COUNT=3;BYDAY=MO'],
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {'dateTime': '2020-01-06T18:00:00+01:00', 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': '2020-01-06T19:00:00+01:00', 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': '2020-01-06T18:00:00+01:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': '2020-01-06T19:00:00+01:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
}
|
||||
recurrence = self.env['calendar.recurrence']._sync_google2odoo(GoogleEvent([values]))
|
||||
events = recurrence.calendar_event_ids.sorted('start')
|
||||
@@ -1012,11 +1014,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'overrides': [{"method": "email", "minutes": 10}], 'useDefault': False},
|
||||
'start': {
|
||||
'dateTime': pytz.utc.localize(start).isoformat(),
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None
|
||||
},
|
||||
'end': {
|
||||
'dateTime': pytz.utc.localize(end).isoformat(),
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None
|
||||
},
|
||||
}
|
||||
self.env['calendar.event']._sync_google2odoo(GoogleEvent([values]))
|
||||
@@ -1041,11 +1045,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'overrides': [{"method": "email", "minutes": 10}], 'useDefault': False},
|
||||
'start': {
|
||||
'dateTime': pytz.utc.localize(start).isoformat(),
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': pytz.utc.localize(end).isoformat(),
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
}
|
||||
self.env['calendar.event']._sync_google2odoo(GoogleEvent([values]))
|
||||
@@ -1084,11 +1090,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2020-01-13T16:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2020-01-13T19:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None
|
||||
},
|
||||
}
|
||||
self.env['calendar.event']._sync_google2odoo(GoogleEvent([values]))
|
||||
@@ -1114,8 +1122,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
# guestsCanModify property is not properly handled yet
|
||||
self.assertGoogleEventPatched(event.google_id, {
|
||||
'id': event.google_id,
|
||||
'start': {'date': str(event.start_date)},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1))},
|
||||
'start': {'date': str(event.start_date), 'dateTime': None},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1)), 'dateTime': None},
|
||||
'summary': 'coucou',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -1160,8 +1168,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
# 'visibility': 'public',
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;COUNT=3;BYDAY=MO'],
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {'dateTime': '2021-02-15T8:00:00+01:00', 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': '2021-02-15T10:00:00+01:00', 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': '2021-02-15T8:00:00+01:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': '2021-02-15T10:00:00+01:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
}
|
||||
self.env['calendar.recurrence']._sync_google2odoo(GoogleEvent([values]))
|
||||
attendee = recurrence.calendar_event_ids.attendee_ids.mapped('state')
|
||||
@@ -1181,8 +1189,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
# 'visibility': 'public',
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;COUNT=3;BYDAY=MO'],
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {'dateTime': '2021-02-15T8:00:00+01:00', 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': '2021-02-15T10:00:00+01:00', 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': '2021-02-15T8:00:00+01:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': '2021-02-15T10:00:00+01:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'guestsCanModify': True,
|
||||
}
|
||||
self.env['calendar.recurrence']._sync_google2odoo(GoogleEvent([values]))
|
||||
@@ -1249,11 +1257,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;COUNT=3;BYDAY=MO'],
|
||||
'start': {
|
||||
'dateTime': '2020-01-13T16:00:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2020-01-13T20:00:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None
|
||||
},
|
||||
}])
|
||||
self.sync(gevent)
|
||||
@@ -1281,11 +1291,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2020-01-13T16:00:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2020-01-13T20:00:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
}
|
||||
event = self.env['calendar.event']._sync_google2odoo(GoogleEvent([values]))
|
||||
@@ -1308,11 +1320,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2020-01-13T16:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2020-01-13T19:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None
|
||||
},
|
||||
'conferenceData': {
|
||||
'entryPoints': [{
|
||||
@@ -1404,11 +1418,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2020-01-13T16:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2020-01-13T19:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'transparency': 'transparent'
|
||||
}
|
||||
@@ -1438,11 +1454,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2020-01-13T16:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2020-01-13T19:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1533,11 +1551,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2020-01-13T16:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2020-01-13T19:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
}
|
||||
self.env['calendar.event']._sync_google2odoo(GoogleEvent([values]))
|
||||
@@ -1576,11 +1596,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2020-01-13T16:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2020-01-13T19:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1643,8 +1665,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'summary': 'First title',
|
||||
'creator': {'email': 'john.doe@example.com', 'self': True},
|
||||
'organizer': {'email': 'john.doe@example.com', 'self': True},
|
||||
'start': {'dateTime': '2023-05-12T09:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': '2023-05-12T10:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': '2023-05-12T09:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': '2023-05-12T10:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;WKST=SU;UNTIL=20230518T215959Z;BYDAY=FR'],
|
||||
'iCalUID': '59orfkiunbn2vlp6c2tndq6ui0@google.com',
|
||||
'reminders': {'useDefault': True},
|
||||
@@ -1659,8 +1681,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'summary': 'Second title',
|
||||
'creator': {'email': 'john.doe@example.com', 'self': True},
|
||||
'organizer': {'email': 'john.doe@example.com', 'self': True},
|
||||
'start': {'dateTime': '2023-05-19T09:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': '2023-05-19T10:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': '2023-05-19T09:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': '2023-05-19T10:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;WKST=SU;COUNT=2;BYDAY=FR'],
|
||||
'iCalUID': '59orfkiunbn2vlp6c2tndq6ui0_R20230519T070000@google.com',
|
||||
'reminders': {'useDefault': True},
|
||||
@@ -1675,8 +1697,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'summary': 'Second title',
|
||||
'creator': {'email': 'john.doe@example.com', 'self': True},
|
||||
'organizer': {'email': 'john.doe@example.com', 'self': True},
|
||||
'start': {'dateTime': '2023-05-26T08:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': '2023-05-26T09:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': '2023-05-26T08:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': '2023-05-26T09:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'recurringEventId': '59orfkiunbn2vlp6c2tndq6ui0_R20230519T070000',
|
||||
'originalStartTime': {'dateTime': '2023-05-26T09:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'reminders': {'useDefault': True},
|
||||
@@ -1751,8 +1773,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'summary': 'First title',
|
||||
'creator': {'email': 'john.doe@example.com', 'self': True},
|
||||
'organizer': {'email': 'john.doe@example.com', 'self': True},
|
||||
'start': {'dateTime': '2023-05-12T09:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': '2023-05-12T10:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': '2023-05-12T09:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': '2023-05-12T10:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;WKST=SU;UNTIL=20230518T215959Z;BYDAY=FR'],
|
||||
'iCalUID': '59orfkiunbn2vlp6c2tndq6ui0@google.com',
|
||||
'reminders': {'useDefault': True},
|
||||
@@ -1767,8 +1789,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'summary': 'Second title',
|
||||
'creator': {'email': 'john.doe@example.com', 'self': True},
|
||||
'organizer': {'email': 'john.doe@example.com', 'self': True},
|
||||
'start': {'dateTime': '2023-05-19T09:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': '2023-05-19T10:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': '2023-05-19T09:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': '2023-05-19T10:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'recurrence': ['RRULE:FREQ=WEEKLY;WKST=SU;COUNT=2;BYDAY=FR'],
|
||||
'iCalUID': '59orfkiunbn2vlp6c2tndq6ui0_R20230519T070000@google.com',
|
||||
'reminders': {'useDefault': True},
|
||||
@@ -1783,8 +1805,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'summary': 'Second title',
|
||||
'creator': {'email': 'john.doe@example.com', 'self': True},
|
||||
'organizer': {'email': 'john.doe@example.com', 'self': True},
|
||||
'start': {'dateTime': '2023-05-26T08:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': '2023-05-26T09:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': '2023-05-26T08:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': '2023-05-26T09:00:00+02:00', 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'recurringEventId': '59orfkiunbn2vlp6c2tndq6ui0', # Range removed
|
||||
'originalStartTime': {'dateTime': '2023-05-26T09:00:00+02:00', 'timeZone': 'Europe/Brussels'},
|
||||
'reminders': {'useDefault': True},
|
||||
@@ -1851,11 +1873,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2023-07-05T16:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2023-07-05T19:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None
|
||||
},
|
||||
}
|
||||
# Create an event editable by guests and organizer.
|
||||
@@ -1874,11 +1898,13 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'reminders': {'useDefault': True},
|
||||
'start': {
|
||||
'dateTime': '2023-07-05T16:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2023-07-05T19:55:00+01:00',
|
||||
'timeZone': 'Europe/Brussels'
|
||||
'timeZone': 'Europe/Brussels',
|
||||
'date': None,
|
||||
},
|
||||
}
|
||||
# Sync events from Google to Odoo and get them after sync.
|
||||
@@ -1936,8 +1962,8 @@ class TestSyncGoogle2Odoo(TestSyncGoogle):
|
||||
'summary': 'coucou',
|
||||
'id': recurrence_id,
|
||||
'recurrence': ['RRULE:FREQ=DAILY;INTERVAL=1;COUNT=3'],
|
||||
'start': {'dateTime': '2020-01-06T10:00:00+01:00'},
|
||||
'end': {'dateTime': '2020-01-06T11:00:00+01:00'},
|
||||
'start': {'dateTime': '2020-01-06T10:00:00+01:00', 'date': None},
|
||||
'end': {'dateTime': '2020-01-06T11:00:00+01:00', 'date': None},
|
||||
'reminders': {'useDefault': True},
|
||||
'organizer': {'email': organizer.partner_id.email},
|
||||
'attendees': [{'email': organizer.partner_id.email, 'responseStatus': 'accepted'}, {'email': other_user.partner_id.email, 'responseStatus': 'accepted'}],
|
||||
|
||||
@@ -47,8 +47,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
event._sync_odoo2google(self.google_service)
|
||||
self.assertGoogleEventInserted({
|
||||
'id': False,
|
||||
'start': {'dateTime': '2020-01-15T08:00:00+00:00'},
|
||||
'end': {'dateTime': '2020-01-15T18:00:00+00:00'},
|
||||
'start': {'dateTime': '2020-01-15T08:00:00+00:00', 'date': None},
|
||||
'end': {'dateTime': '2020-01-15T18:00:00+00:00', 'date': None},
|
||||
'summary': 'Event',
|
||||
'description': tools.html_sanitize(description),
|
||||
'location': '',
|
||||
@@ -159,8 +159,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
event._sync_odoo2google(self.google_service)
|
||||
self.assertGoogleEventInserted({
|
||||
'id': False,
|
||||
'start': {'dateTime': '2020-01-15T08:00:00+00:00'},
|
||||
'end': {'dateTime': '2020-01-15T18:00:00+00:00'},
|
||||
'start': {'dateTime': '2020-01-15T08:00:00+00:00', 'date': None},
|
||||
'end': {'dateTime': '2020-01-15T18:00:00+00:00', 'date': None},
|
||||
'summary': 'Event',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -185,8 +185,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
event._sync_odoo2google(self.google_service)
|
||||
self.assertGoogleEventInserted({
|
||||
'id': False,
|
||||
'start': {'date': '2020-01-15'},
|
||||
'end': {'date': '2020-01-16'},
|
||||
'start': {'date': '2020-01-15', 'dateTime': None},
|
||||
'end': {'date': '2020-01-16', 'dateTime': None},
|
||||
'summary': 'Event',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -246,8 +246,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
recurrence._sync_odoo2google(self.google_service)
|
||||
self.assertGoogleEventInserted({
|
||||
'id': False,
|
||||
'start': {'date': '2020-01-15'},
|
||||
'end': {'date': '2020-01-16'},
|
||||
'start': {'date': '2020-01-15', 'dateTime': None},
|
||||
'end': {'date': '2020-01-16', 'dateTime': None},
|
||||
'summary': 'Event',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -281,8 +281,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
self.assertFalse(event.google_id, "The google id will be set after the API call")
|
||||
self.assertGoogleEventInserted({
|
||||
'id': False,
|
||||
'start': {'date': '2020-01-15'},
|
||||
'end': {'date': '2020-01-16'},
|
||||
'start': {'date': '2020-01-15', 'dateTime': None},
|
||||
'end': {'date': '2020-01-16', 'dateTime': None},
|
||||
'summary': 'Event',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -329,8 +329,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
})
|
||||
self.assertGoogleEventInserted({
|
||||
'id': False,
|
||||
'start': {'date': str(event.start_date)},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1))},
|
||||
'start': {'date': str(event.start_date), 'dateTime': None},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1)), 'dateTime': None},
|
||||
'summary': 'New name',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -380,8 +380,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
user.with_user(user).restart_google_synchronization()
|
||||
self.assertGoogleEventPatched(event.google_id, {
|
||||
'id': event.google_id,
|
||||
'start': {'dateTime': '2020-01-15T08:00:00+00:00'},
|
||||
'end': {'dateTime': '2020-01-15T18:00:00+00:00'},
|
||||
'start': {'dateTime': '2020-01-15T08:00:00+00:00', 'date': None},
|
||||
'end': {'dateTime': '2020-01-15T18:00:00+00:00', 'date': None},
|
||||
'summary': 'Event',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -417,8 +417,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
new_recurrence = self.env['calendar.recurrence'].search([('id', '>', recurrence.id)])
|
||||
self.assertGoogleEventInserted({
|
||||
'id': False,
|
||||
'start': {'date': str(event.start_date)},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1))},
|
||||
'start': {'date': str(event.start_date), 'dateTime': None},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1)), 'dateTime': None},
|
||||
'summary': 'New name',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -547,8 +547,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
event.attendee_ids.do_decline()
|
||||
self.assertGoogleEventPatched(event.google_id, {
|
||||
'id': event.google_id,
|
||||
'start': {'date': str(event.start_date)},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1))},
|
||||
'start': {'date': str(event.start_date), 'dateTime': None},
|
||||
'end': {'date': str(event.stop_date + relativedelta(days=1)), 'dateTime': None},
|
||||
'summary': 'Event with attendees',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -584,8 +584,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
new_recurrence = self.env['calendar.recurrence'].search([('id', '>', recurrence.id)])
|
||||
self.assertGoogleEventInserted({
|
||||
'id': False,
|
||||
'start': {'dateTime': "2020-01-15T08:00:00+00:00", 'timeZone': 'Europe/Brussels'},
|
||||
'end': {'dateTime': "2020-01-15T09:00:00+00:00", 'timeZone': 'Europe/Brussels'},
|
||||
'start': {'dateTime': "2020-01-15T08:00:00+00:00", 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'end': {'dateTime': "2020-01-15T09:00:00+00:00", 'timeZone': 'Europe/Brussels', 'date': None},
|
||||
'summary': 'New name',
|
||||
'description': '',
|
||||
'location': '',
|
||||
@@ -657,8 +657,8 @@ class TestSyncOdoo2Google(TestSyncGoogle):
|
||||
event_1.action_mass_archive('self_only')
|
||||
self.assertGoogleEventPatched(event_1.google_id, {
|
||||
'id': event_1.google_id,
|
||||
'start': {'dateTime': '2023-06-15T10:00:00+00:00'},
|
||||
'end': {'dateTime': '2023-06-15T10:00:00+00:00'},
|
||||
'start': {'dateTime': '2023-06-15T10:00:00+00:00', 'date': None},
|
||||
'end': {'dateTime': '2023-06-15T10:00:00+00:00', 'date': None},
|
||||
'summary': 'Event',
|
||||
'description': '',
|
||||
'location': '',
|
||||
|
||||
Reference in New Issue
Block a user