[FIX] calendar: fix allday onchange user tz
While choosing a start/stop datetime in a timezone hour were the UTC value is within the next day, e.g. Start time Dec 22 20:00 in US/Eastner (UTC -5:00) Therefore, start time Dec 23 01:00 in UTC Checking the "all day" box made the start time set to Dec 23 instead of what the user expected, Dec 22. This is because the onchange simply took the UTC datetime (Dec 23 01:00) from which it removed the time (Dec 23). This revision make sure to remove the time from the user timezoned datetime instead, so the day set remain the same day than what was set in the datetime. opw-702065
This commit is contained in:
parent
c0889a0763
commit
09066fbbd5
|
@ -1016,12 +1016,12 @@ class calendar_event(osv.Model):
|
||||||
startdatetime = startdatetime or start
|
startdatetime = startdatetime or start
|
||||||
if startdatetime:
|
if startdatetime:
|
||||||
start = datetime.strptime(startdatetime, DEFAULT_SERVER_DATETIME_FORMAT)
|
start = datetime.strptime(startdatetime, DEFAULT_SERVER_DATETIME_FORMAT)
|
||||||
value['start_date'] = datetime.strftime(start, DEFAULT_SERVER_DATE_FORMAT)
|
value['start_date'] = fields.date.context_today(self, cr, uid, context=context, timestamp=start)
|
||||||
|
|
||||||
enddatetime = enddatetime or end
|
enddatetime = enddatetime or end
|
||||||
if enddatetime:
|
if enddatetime:
|
||||||
end = datetime.strptime(enddatetime, DEFAULT_SERVER_DATETIME_FORMAT)
|
end = datetime.strptime(enddatetime, DEFAULT_SERVER_DATETIME_FORMAT)
|
||||||
value['stop_date'] = datetime.strftime(end, DEFAULT_SERVER_DATE_FORMAT)
|
value['stop_date'] = fields.date.context_today(self, cr, uid, context=context, timestamp=end)
|
||||||
else: # from date to datetime
|
else: # from date to datetime
|
||||||
user = self.pool['res.users'].browse(cr, uid, uid, context)
|
user = self.pool['res.users'].browse(cr, uid, uid, context)
|
||||||
tz = pytz.timezone(user.tz) if user.tz else pytz.utc
|
tz = pytz.timezone(user.tz) if user.tz else pytz.utc
|
||||||
|
|
Loading…
Reference in New Issue