[FIX]: caldav: Fixed problem of Importing date with timezone information(converted into utc)
bzr revid: rpa@tinyerp.com-20100804133758-a0u50if8z3rol31l
This commit is contained in:
parent
3f284dd7e9
commit
bd76d0a66a
|
@ -257,6 +257,9 @@ class CalDAV(object):
|
|||
if cal_data.name.lower() in self.__attribute__:
|
||||
if cal_data.params.get('X-VOBJ-ORIGINAL-TZID'):
|
||||
self.ical_set('vtimezone', cal_data.params.get('X-VOBJ-ORIGINAL-TZID'), 'value')
|
||||
date_utc = cal_data.value.astimezone(pytz.utc)
|
||||
self.ical_set(cal_data.name.lower(), date_utc, 'value')
|
||||
continue
|
||||
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
|
||||
vals = map_data(cr, uid, self, context=context)
|
||||
return vals
|
||||
|
@ -331,8 +334,7 @@ class CalDAV(object):
|
|||
if tzval:
|
||||
date_1 = datetime.strptime(data[map_field], '%Y-%m-%d %H:%M:%S')
|
||||
desttz = pytz.timezone(tzval.title())
|
||||
srctz = pytz.timezone('GMT')
|
||||
date_gmt = date_1.replace(tzinfo=srctz).astimezone(desttz).strftime('%Y-%m-%d %H:%M:%S')
|
||||
date_gmt = date_1.replace(tzinfo=pytz.utc).astimezone(desttz).strftime('%Y-%m-%d %H:%M:%S')
|
||||
dtfield.params['TZID'] = [tzval.title()]
|
||||
dtfield.value = parser.parse(date_gmt)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue