diff --git a/web_switch_company_warning/__manifest__.py b/web_switch_company_warning/__manifest__.py index d3007d58..f7f5e13c 100644 --- a/web_switch_company_warning/__manifest__.py +++ b/web_switch_company_warning/__manifest__.py @@ -6,7 +6,7 @@ " in another tab or window.", "version": "12.0.1.0.0", "category": "web", - "website": "http://akretion.com", + "website": "https://github.com/OCA/web", "license": "AGPL-3", "author": "Akretion, " "Odoo Community Association (OCA)", diff --git a/web_switch_company_warning/static/src/js/switch_company_warning.js b/web_switch_company_warning/static/src/js/switch_company_warning.js index 032bba4e..820f3700 100644 --- a/web_switch_company_warning/static/src/js/switch_company_warning.js +++ b/web_switch_company_warning/static/src/js/switch_company_warning.js @@ -4,16 +4,16 @@ odoo.define('web_switch_company_warning.widget', function (require) { var Widget = require('web.Widget'); var UserMenu = require('web.UserMenu'); var session = require('web.session'); - //Show a big banner in the top of the page if the company has been - //changed in another tab or window (in the same browser) + // Show a big banner in the top of the page if the company has been + // changed in another tab or window (in the same browser) if (!window.SharedWorker) { - //not supported + // Not supported return; } var SwitchCompanyWarningWidget = Widget.extend({ template:'web_switch_company_warning.warningWidget', - init: function() { + init: function () { this._super(); var self = this; var w = new SharedWorker('/web_switch_company_warning/static/src/js/switch_company_warning_worker.js'); @@ -21,7 +21,7 @@ odoo.define('web_switch_company_warning.widget', function (require) { if (msg.data.type !== 'newCtx') { return; } - if(msg.data.newCtx === self.generateSignature()) { + if (msg.data.newCtx === self.generateSignature()) { self.$el.hide(); } else { self.$el.show(); @@ -30,17 +30,17 @@ odoo.define('web_switch_company_warning.widget', function (require) { w.port.start(); w.port.postMessage(this.generateSignature()); }, - generateSignature: function() { + generateSignature: function () { return [session.company_id, session.db].join(); - } + }, }); UserMenu.include({ - init: function(parent) { + init: function (parent) { this._super(parent); var switchCompanyWarning = new SwitchCompanyWarningWidget(); switchCompanyWarning.insertAfter('.o_main_navbar'); - } + }, }); diff --git a/web_switch_company_warning/static/src/js/switch_company_warning_worker.js b/web_switch_company_warning/static/src/js/switch_company_warning_worker.js index f5f23add..dd8a0860 100644 --- a/web_switch_company_warning/static/src/js/switch_company_warning_worker.js +++ b/web_switch_company_warning/static/src/js/switch_company_warning_worker.js @@ -1,11 +1,12 @@ -"use strict"; -//Show a big banner in the top of the page if the company has been -//changed in another tab or window (in the same browser) +// Show a big banner in the top of the page if the company has been +// Changed in another tab or window (in the same browser) var con = []; var lastCtx = null; -addEventListener("connect", function(ee) { +addEventListener("connect", function (ee) { + "use strict"; + var port = ee.ports[0]; con.push(port);