mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
fixup
This commit is contained in:
@@ -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)",
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user