From 798a10082cce87fc38e95164eea606d491b777a0 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 22 Dec 2016 14:44:05 +0100 Subject: [PATCH] [FIX] google_calendar: fix allday timezone synchronisation When syncrhonizing an allday event while being in a negative timezone e.g. Dec 22 in US/Eastner (-5:00) The event was synchronized the day before e.g. Dec 21 because `context_timestamp` of `start date-time-` was used, and then the time was removed to have the date of the all day event e.g. 2016-12-22 00:00:00 converted to 2016-12-21 19:00:00 and then the time removed 2016-12-21. Instead of using the `start_datetime`, we now use the start date which stores only the date, without timezone information (and this is what you would like in the case of an all day event). opw-697202 --- addons/google_calendar/google_calendar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/google_calendar/google_calendar.py b/addons/google_calendar/google_calendar.py index 995490c3cca..3a242a7c02a 100644 --- a/addons/google_calendar/google_calendar.py +++ b/addons/google_calendar/google_calendar.py @@ -205,8 +205,8 @@ class google_calendar(osv.AbstractModel): if not context: 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.stop, tools.DEFAULT_SERVER_DATETIME_FORMAT) + timedelta(days=1), context=context).isoformat('T').split('T')[0] + start_date = event.start_date + final_date = (datetime.strptime(event.stop_date, tools.DEFAULT_SERVER_DATE_FORMAT) + timedelta(days=1)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) type = 'date' vstype = 'dateTime' else: