diff --git a/web_switch_company_warning/README.rst b/web_switch_company_warning/README.rst index bdf0b58a..3cd13060 100644 --- a/web_switch_company_warning/README.rst +++ b/web_switch_company_warning/README.rst @@ -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). * 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 =========== diff --git a/web_switch_company_warning/i18n/en.po b/web_switch_company_warning/i18n/en.po index 55c4a2e5..b80ba818 100644 --- a/web_switch_company_warning/i18n/en.po +++ b/web_switch_company_warning/i18n/en.po @@ -7,15 +7,17 @@ msgid "" msgstr "" "Project-Id-Version: web (8.0)\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-11-23 13:46+0000\n" -"PO-Revision-Date: 2015-11-07 11:21+0000\n" +"POT-Creation-Date: 2016-01-11 16:22+0100\n" +"PO-Revision-Date: 2016-01-11 16:22+0100\n" "Last-Translator: OCA Transbot \n" -"Language-Team: English (http://www.transifex.com/oca/OCA-web-8-0/language/en/)\n" +"Language-Team: English (http://www.transifex.com/oca/OCA-web-8-0/language/" +"en/)\n" +"Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: en\n" +"Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.8.6\n" #. module: web_switch_company_warning #. openerp-web @@ -28,8 +30,8 @@ msgstr "Reload" #. openerp-web #: code:addons/web_switch_company_warning/static/src/xml/switch_company_warning.xml:5 #, python-format -msgid "You switched to a different company with another tab or window" -msgstr "You switched to a different company with another tab or window" +msgid "You switched to a different company or user with another tab or window" +msgstr "You switched to a different company or user with another tab or window" #. module: web_switch_company_warning #. openerp-web diff --git a/web_switch_company_warning/i18n/fr.po b/web_switch_company_warning/i18n/fr.po index 1b7b368c..4f492723 100644 --- a/web_switch_company_warning/i18n/fr.po +++ b/web_switch_company_warning/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-10-20 22:08+0000\n" -"PO-Revision-Date: 2015-10-21 00:15+0100\n" +"POT-Creation-Date: 2016-01-11 16:19+0100\n" +"PO-Revision-Date: 2016-01-11 16:20+0100\n" "Last-Translator: <>\n" "Language-Team: \n" "Language: fr\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: \n" -"X-Generator: Poedit 1.7.5\n" +"X-Generator: Poedit 1.8.6\n" #. module: web_switch_company_warning #. openerp-web @@ -28,8 +28,8 @@ msgstr "Recharger" #. openerp-web #: code:addons/web_switch_company_warning/static/src/xml/switch_company_warning.xml:5 #, python-format -msgid "You switched to a different company with another tab or window" -msgstr "Vous avez basculé vers une société différente depuis un autre onglet ou fenêtre." +msgid "You switched to a different company or user with another tab or window" +msgstr "Vous avez basculé vers une société ou un utilisateur différent depuis un autre onglet ou fenêtre." #. module: web_switch_company_warning #. openerp-web diff --git a/web_switch_company_warning/i18n/web_switch_company_warning.pot b/web_switch_company_warning/i18n/web_switch_company_warning.pot index 26c607d4..eb1e9e81 100644 --- a/web_switch_company_warning/i18n/web_switch_company_warning.pot +++ b/web_switch_company_warning/i18n/web_switch_company_warning.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-10-20 22:08+0000\n" -"PO-Revision-Date: 2015-10-20 22:08+0000\n" +"POT-Creation-Date: 2016-01-11 15:15+0000\n" +"PO-Revision-Date: 2016-01-11 15:15+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -26,7 +26,7 @@ msgstr "" #. openerp-web #: code:addons/web_switch_company_warning/static/src/xml/switch_company_warning.xml:5 #, python-format -msgid "You switched to a different company with another tab or window" +msgid "You switched to a different company or user with another tab or window" msgstr "" #. module: web_switch_company_warning 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 a49040fc..d24be0ac 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 @@ -25,7 +25,7 @@ openerp.web_switch_company_warning = function (instance) { if (msg.data.type !== 'newCtx') return; - if(msg.data.newCtx != self.session.company_id) { + if(msg.data.newCtx != self.signature(self.session)) { self.$el.show(); } else { self.$el.hide(); @@ -33,7 +33,10 @@ openerp.web_switch_company_warning = function (instance) { }); w.port.start(); - w.port.postMessage(this.session.company_id); + w.port.postMessage(self.signature(this.session)); + }, + signature: function (session) { + return [session.db, session.uid, session.company_id].join(); } }); diff --git a/web_switch_company_warning/static/src/xml/switch_company_warning.xml b/web_switch_company_warning/static/src/xml/switch_company_warning.xml index 7943516e..755ef081 100644 --- a/web_switch_company_warning/static/src/xml/switch_company_warning.xml +++ b/web_switch_company_warning/static/src/xml/switch_company_warning.xml @@ -2,7 +2,7 @@