mirror of https://github.com/OCA/web.git
parent
fc6a5ece31
commit
402f45b61e
|
@ -7,17 +7,21 @@ Web Switch Company Warning
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
|
||||||
Shows a warning if current company has been switched in another tab or window.
|
Shows a warning if current (company|user|db) has been changed within another tab or window.
|
||||||
|
|
||||||
|
|
||||||
Known issues / Roadmap
|
Known issues
|
||||||
======================
|
============
|
||||||
|
|
||||||
|
|
||||||
* If the browser don't implement Sharded Worker (http://www.w3.org/TR/workers/#sharedworker), the warning message will not be displayed (there is no polyfill).
|
* If the browser don't implement Sharded Worker (http://www.w3.org/TR/workers/#sharedworker), the warning message will not be displayed (there is no polyfill).
|
||||||
|
|
||||||
* Switching company in a separate browser or in private browsing mode will not be detected by this module. It's a limitation of Shared Wworker(limit to browser session, server:port...)
|
* Switching company in a separate browser or in private browsing mode will not be detected by this module. It's a limitation of Shared Wworker(limit to browser session, server:port...)
|
||||||
|
|
||||||
|
Updates
|
||||||
|
=======
|
||||||
|
* Jan 2016 : [IMP] add user and db in change detection
|
||||||
|
* Sep 2015 : First version
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
@ -25,7 +25,7 @@ openerp.web_switch_company_warning = function (instance) {
|
||||||
if (msg.data.type !== 'newCtx')
|
if (msg.data.type !== 'newCtx')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(msg.data.newCtx != self.session.company_id) {
|
if(msg.data.newCtx != signature(self.session)) {
|
||||||
self.$el.show();
|
self.$el.show();
|
||||||
} else {
|
} else {
|
||||||
self.$el.hide();
|
self.$el.hide();
|
||||||
|
@ -33,7 +33,11 @@ openerp.web_switch_company_warning = function (instance) {
|
||||||
});
|
});
|
||||||
|
|
||||||
w.port.start();
|
w.port.start();
|
||||||
w.port.postMessage(this.session.company_id);
|
w.port.postMessage(signature(this.session));
|
||||||
|
|
||||||
|
function signature(session) {
|
||||||
|
return [session.db, session.uid, session.company_id].join();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<template>
|
<template>
|
||||||
<t t-name="web_switch_company_warning.warningWidget">
|
<t t-name="web_switch_company_warning.warningWidget">
|
||||||
<div class="container-fluid bg-warning" style="text-align: center; display:none;">
|
<div class="container-fluid bg-warning" style="text-align: center; display:none;">
|
||||||
<h3>You switched to a different company with another tab or window</h3>
|
<h3>You switched to a different company or user with another tab or window</h3>
|
||||||
<p><button onclick="location.reload(true);" class="btn">Reload</button> to refresh your session</p>
|
<p><button onclick="location.reload(true);" class="btn">Reload</button> to refresh your session</p>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
|
|
Loading…
Reference in New Issue