summaryrefslogtreecommitdiff
path: root/addons/web/models
diff options
context:
space:
mode:
authorAdrien Dieudonne <adr@odoo.com>2017-08-16 14:49:08 +0200
committerAaron Bohy <aab@odoo.com>2017-08-17 17:24:00 +0200
commitf5b7ad80fcfd1638cb7ea019a38871c3b8438e36 (patch)
treee8d5b29cfb608c04f0e67450d0d5a851607ffbea /addons/web/models
parentb9bfec96dd038d23e26cc822560fee452a0a3271 (diff)
[FIX] web: always use browser timezone
With the new views, we stopped using the browser timezone to display the dates in Odoo, and we used the timezone defined on the User profile instead. When loading the webclient, the timezone offset was put into the session and used to display all dates. This wasn't a good idea. The given offset was computed for the current time, meaning that it may be incorrect for specific dates (e.g. with the daylight saving, the UTC offset of today is not the same as 6 months ago). Moreover (but less likely), as the offset was stored in the session, it wasn't recalculated afterwards. So if the offset actually changed during the session (e.g. from or to daylight saving time), the displayed dates were incorrect until the user reloaded the page. With this rev., we don't retrieve the offset from the server anymore and we use the browser timezone again (like before the new views). However, we keep the computation of the offset (on the fly) in the session, so that it can be mocked in the test environment.
Diffstat (limited to 'addons/web/models')
-rw-r--r--addons/web/models/ir_http.py3
1 files changed, 0 insertions, 3 deletions
diff --git a/addons/web/models/ir_http.py b/addons/web/models/ir_http.py
index 73a83664683..a1fa58ef81d 100644
--- a/addons/web/models/ir_http.py
+++ b/addons/web/models/ir_http.py
@@ -5,8 +5,6 @@ import json
from odoo import models
from odoo.http import request
-import pytz
-import datetime
import odoo
@@ -26,7 +24,6 @@ class Http(models.AbstractModel):
version_info = odoo.service.common.exp_version()
return {
"session_id": request.session.sid,
- "tzOffset": self._context.get('tz') and datetime.datetime.now(pytz.timezone(self._context['tz'])).utcoffset().total_seconds() / 60 or False,
"uid": request.session.uid,
"is_system": request.env.user._is_system(),
"is_superuser": request.env.user._is_superuser(),