Skip to content
Snippets Groups Projects
Commit 62cb3c08 authored by pedrambiria's avatar pedrambiria
Browse files

[FIX] google_calendar: accept events that start and end dates are equal

What is the problem?
We assumed that an all-day event's end date is exclusive which means
that, for example, for a single all-day event on the 2022-03-20,
we have:
start = {'date': '2022-03-20'}
end = {'date': '2022-03-21'}

But it's acceptable for Google to have an all-day event where the start
and end dates are the same:
start = {'date': '2022-03-20'}
end = {'date': '2022-03-20'}

For checking the acceptability of this format, you can test it:
https://developers.google.com/calendar/api/v3/reference/events/insert



It caused an issue because we decreased one day from the end date to
convert it to the odoo values, so the stop became smaller than the
start:
start = '2022-03-20 00:00:00'
stop = '2022-03-19 00:00:00'

It's not possible to reproduce the issue by the Google calendar UI.
However, you can insert an event with this format by using the APIs
and get that event to reproduce the problem.

The solution is to use start if the stop becomes smaller than it.

opw-2753872

closes odoo/odoo#87646

Signed-off-by: default avatarArnaud Joset <arj@odoo.com>
parent 687d88ee
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,7 @@ class Meeting(models.Model):
else:
start = parse(google_event.start.get('date'))
stop = parse(google_event.end.get('date')) - relativedelta(days=1)
stop = max(start, stop) # For the cases that start date and end date were the same
values['allday'] = True
values['start'] = start
values['stop'] = stop
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment