[FIX] google_calendar: all day event stop date

For an event during all day, during 2 days,
e.g. September 9th and September 10th,
Google expects as start date the first day, and as
stop date the day after the last day.
e.g.
start 2015-09-09
stop 2015-09-11

Even if, afterwise, in the Google Agenda interface, it will
be correctly displayed 2015-09-10 as end date.

This must be applied at the event creation AND at the event
update. It was not the case until this revision.

Besides, we now use the event `stop_date` in Odoo, instead
of the duration, in case the duration has been incorrectly
computed.

opw-648867
This commit is contained in:
Denis Ledoux 2015-09-08 17:15:49 +02:00
parent 3280819142
commit e509f9155b
1 changed files with 1 additions and 1 deletions

View File

@ -206,7 +206,7 @@ class google_calendar(osv.AbstractModel):
context = {}
if event.allday:
start_date = fields.datetime.context_timestamp(cr, uid, datetime.strptime(event.start, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context).isoformat('T').split('T')[0]
final_date = fields.datetime.context_timestamp(cr, uid, datetime.strptime(event.start, tools.DEFAULT_SERVER_DATETIME_FORMAT) + timedelta(hours=event.duration) + timedelta(days=isCreating and 1 or 0), context=context).isoformat('T').split('T')[0]
final_date = fields.datetime.context_timestamp(cr, uid, datetime.strptime(event.stop, tools.DEFAULT_SERVER_DATETIME_FORMAT) + timedelta(days=1), context=context).isoformat('T').split('T')[0]
type = 'date'
vstype = 'dateTime'
else: