summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorDavid Beguin <dbe@odoo.com>2020-09-04 14:04:10 +0000
committerDavid Beguin <dbe@odoo.com>2020-10-08 09:13:58 +0000
commit3d9a2de3575777c87327691319d89f9de6b8eada (patch)
treeff3a7fe870ff20ac55ce2188a412b8efdbd376d0 /addons/website/static/src
parent6d6e48f34f850fa533ce00532ada0e3464c8144b (diff)
[FIX] website: get visitor tz directly from cookie
Since tz is now (from 6eb4762fee20a158023d774a90e7ee90c2cacec5) added to the client cookie, visitor timezone can directly be set when creating the visitor, using the request. Jstz can be removed as even for module in ENT that used this lib, we can get the timezone using Intl lib instead. This will also reduce the number of request made only to get visitor's timezone. This commit reverts part of 17e84025239ed78716ed5d5d92c0ee0e10fbfb29 Linked ENT PR: 12963 Task ID: 2333825 closes odoo/odoo#57103 Related: odoo/enterprise#12963 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/visitor_timezone.js37
1 files changed, 1 insertions, 36 deletions
diff --git a/addons/website/static/src/js/visitor_timezone.js b/addons/website/static/src/js/visitor_timezone.js
index b8cd2e06cbd..b8441beae4b 100644
--- a/addons/website/static/src/js/visitor_timezone.js
+++ b/addons/website/static/src/js/visitor_timezone.js
@@ -1,36 +1 @@
-//
-// This file is meant to determine the timezone of a website visitor
-// If the visitor already exists, no need to keep the timezone cookie
-// as the timezone is set on the visitor.
-//
-odoo.define('website.visitor_timezone', function (require) {
-'use strict';
-
-var ajax = require('web.ajax');
-var utils = require('web.utils');
-var publicWidget = require('web.public.widget');
-
-publicWidget.registry.visitorTimezone = publicWidget.Widget.extend({
- selector: '#wrapwrap',
-
- start: function () {
- if (!localStorage.getItem('website.found_visitor_timezone')) {
- var timezone = jstz.determine().name();
- this._rpc({
- route: '/website/update_visitor_timezone',
- params: {
- 'timezone': timezone,
- },
- }).then(function (result) {
- if (result) {
- localStorage.setItem('website.found_visitor_timezone', true);
- }
- });
- }
- return this._super.apply(this, arguments);
- },
-});
-
-return publicWidget.registry.visitorTimezone;
-
-});
+// To remove after v14.0 \ No newline at end of file