From 99cdb6069f3155b651729e710193afbf8991c1d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Gil=20Sorribes?= Date: Tue, 4 Jun 2019 13:17:44 +0200 Subject: [PATCH] [IMP] add user switch detection and rename module --- .../readme/CONTRIBUTORS.rst | 1 - .../readme/DESCRIPTION.rst | 1 - .../README.rst | 17 +++++++++-------- .../__init__.py | 0 .../__manifest__.py | 6 +++--- .../i18n/web_switch_company_warning.pot | 14 +++++++------- .../readme/CONTRIBUTORS.rst | 2 ++ .../readme/DESCRIPTION.rst | 1 + .../readme/ROADMAP.rst | 0 .../readme/USAGE.rst | 0 .../static/description/icon.png | Bin .../static/description/index.html | 15 ++++++++------- .../static/src/js/switch_company_warning.js | 9 +++++---- .../src/js/switch_company_warning_worker.js | 0 .../static/src/xml/switch_company_warning.xml | 4 ++-- .../view/view.xml | 4 ++-- 16 files changed, 39 insertions(+), 35 deletions(-) delete mode 100644 web_switch_company_warning/readme/CONTRIBUTORS.rst delete mode 100644 web_switch_company_warning/readme/DESCRIPTION.rst rename {web_switch_company_warning => web_switch_context_warning}/README.rst (85%) rename {web_switch_company_warning => web_switch_context_warning}/__init__.py (100%) rename {web_switch_company_warning => web_switch_context_warning}/__manifest__.py (75%) rename {web_switch_company_warning => web_switch_context_warning}/i18n/web_switch_company_warning.pot (66%) create mode 100644 web_switch_context_warning/readme/CONTRIBUTORS.rst create mode 100644 web_switch_context_warning/readme/DESCRIPTION.rst rename {web_switch_company_warning => web_switch_context_warning}/readme/ROADMAP.rst (100%) rename {web_switch_company_warning => web_switch_context_warning}/readme/USAGE.rst (100%) rename {web_switch_company_warning => web_switch_context_warning}/static/description/icon.png (100%) rename {web_switch_company_warning => web_switch_context_warning}/static/description/index.html (94%) rename {web_switch_company_warning => web_switch_context_warning}/static/src/js/switch_company_warning.js (86%) rename {web_switch_company_warning => web_switch_context_warning}/static/src/js/switch_company_warning_worker.js (100%) rename {web_switch_company_warning => web_switch_context_warning}/static/src/xml/switch_company_warning.xml (64%) rename {web_switch_company_warning => web_switch_context_warning}/view/view.xml (69%) diff --git a/web_switch_company_warning/readme/CONTRIBUTORS.rst b/web_switch_company_warning/readme/CONTRIBUTORS.rst deleted file mode 100644 index 6d47ddbd..00000000 --- a/web_switch_company_warning/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1 +0,0 @@ -* Hparfr diff --git a/web_switch_company_warning/readme/DESCRIPTION.rst b/web_switch_company_warning/readme/DESCRIPTION.rst deleted file mode 100644 index 907bca11..00000000 --- a/web_switch_company_warning/readme/DESCRIPTION.rst +++ /dev/null @@ -1 +0,0 @@ -Shows a warning if current company has been switched in another tab or window. diff --git a/web_switch_company_warning/README.rst b/web_switch_context_warning/README.rst similarity index 85% rename from web_switch_company_warning/README.rst rename to web_switch_context_warning/README.rst index e51ab70d..78258d6c 100644 --- a/web_switch_company_warning/README.rst +++ b/web_switch_context_warning/README.rst @@ -1,6 +1,6 @@ -===================================== -Multicompany - Switch Company Warning -===================================== +====================== +Switch Context Warning +====================== .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! @@ -14,10 +14,10 @@ Multicompany - Switch Company Warning :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github - :target: https://github.com/OCA/web/tree/11.0/web_switch_company_warning + :target: https://github.com/OCA/web/tree/11.0/web_switch_context_warning :alt: OCA/web .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_switch_company_warning + :target: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_switch_context_warning :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png :target: https://runbot.odoo-community.org/runbot/162/11.0 @@ -25,7 +25,7 @@ Multicompany - Switch Company Warning |badge1| |badge2| |badge3| |badge4| |badge5| -Shows a warning if current company has been switched in another tab or window. +Shows a warning if current user, company or database have been switched in another tab or window. **Table of contents** @@ -45,7 +45,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -61,6 +61,7 @@ Contributors ~~~~~~~~~~~~ * Hparfr +* Adria Gil Sorribes Maintainers ~~~~~~~~~~~ @@ -75,6 +76,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/web `_ project on GitHub. +This module is part of the `OCA/web `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_switch_company_warning/__init__.py b/web_switch_context_warning/__init__.py similarity index 100% rename from web_switch_company_warning/__init__.py rename to web_switch_context_warning/__init__.py diff --git a/web_switch_company_warning/__manifest__.py b/web_switch_context_warning/__manifest__.py similarity index 75% rename from web_switch_company_warning/__manifest__.py rename to web_switch_context_warning/__manifest__.py index b62fab79..e405f8f9 100644 --- a/web_switch_company_warning/__manifest__.py +++ b/web_switch_context_warning/__manifest__.py @@ -1,9 +1,9 @@ # Copyright 2017 Akretion # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { - "name": "Multicompany - Switch Company Warning", - "summary": "Show a warning if current company has been switched" - " in another tab or window.", + "name": "Switch Context Warning", + "summary": "Show a warning if current user, company or database " + "have been switched in another tab or window.", "version": "11.0.1.0.0", "category": "web", "website": "https://github.com/OCA/web", diff --git a/web_switch_company_warning/i18n/web_switch_company_warning.pot b/web_switch_context_warning/i18n/web_switch_company_warning.pot similarity index 66% rename from web_switch_company_warning/i18n/web_switch_company_warning.pot rename to web_switch_context_warning/i18n/web_switch_company_warning.pot index ccf2d1b5..ed79158e 100644 --- a/web_switch_company_warning/i18n/web_switch_company_warning.pot +++ b/web_switch_context_warning/i18n/web_switch_company_warning.pot @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * web_switch_company_warning +# * web_switch_context_warning # msgid "" msgstr "" @@ -13,23 +13,23 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: web_switch_company_warning +#. module: web_switch_context_warning #. openerp-web -#: code:addons/web_switch_company_warning/static/src/xml/switch_company_warning.xml:6 +#: code:addons/web_switch_context_warning/static/src/xml/switch_company_warning.xml:6 #, python-format msgid "Reload" msgstr "" -#. module: web_switch_company_warning +#. module: web_switch_context_warning #. openerp-web -#: code:addons/web_switch_company_warning/static/src/xml/switch_company_warning.xml:5 +#: code:addons/web_switch_context_warning/static/src/xml/switch_company_warning.xml:5 #, python-format msgid "You switched to a different company or database with another tab or window" msgstr "" -#. module: web_switch_company_warning +#. module: web_switch_context_warning #. openerp-web -#: code:addons/web_switch_company_warning/static/src/xml/switch_company_warning.xml:6 +#: code:addons/web_switch_context_warning/static/src/xml/switch_company_warning.xml:6 #, python-format msgid "to refresh your session" msgstr "" diff --git a/web_switch_context_warning/readme/CONTRIBUTORS.rst b/web_switch_context_warning/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..0e095736 --- /dev/null +++ b/web_switch_context_warning/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Hparfr +* Adria Gil Sorribes diff --git a/web_switch_context_warning/readme/DESCRIPTION.rst b/web_switch_context_warning/readme/DESCRIPTION.rst new file mode 100644 index 00000000..166b67eb --- /dev/null +++ b/web_switch_context_warning/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Shows a warning if current user, company or database have been switched in another tab or window. diff --git a/web_switch_company_warning/readme/ROADMAP.rst b/web_switch_context_warning/readme/ROADMAP.rst similarity index 100% rename from web_switch_company_warning/readme/ROADMAP.rst rename to web_switch_context_warning/readme/ROADMAP.rst diff --git a/web_switch_company_warning/readme/USAGE.rst b/web_switch_context_warning/readme/USAGE.rst similarity index 100% rename from web_switch_company_warning/readme/USAGE.rst rename to web_switch_context_warning/readme/USAGE.rst diff --git a/web_switch_company_warning/static/description/icon.png b/web_switch_context_warning/static/description/icon.png similarity index 100% rename from web_switch_company_warning/static/description/icon.png rename to web_switch_context_warning/static/description/icon.png diff --git a/web_switch_company_warning/static/description/index.html b/web_switch_context_warning/static/description/index.html similarity index 94% rename from web_switch_company_warning/static/description/index.html rename to web_switch_context_warning/static/description/index.html index 250fbdd5..529d70c6 100644 --- a/web_switch_company_warning/static/description/index.html +++ b/web_switch_context_warning/static/description/index.html @@ -4,7 +4,7 @@ -Multicompany - Switch Company Warning +Switch Context Warning -
-

Multicompany - Switch Company Warning

+
+

Switch Context Warning

-

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

-

Shows a warning if current company has been switched in another tab or window.

+

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

Shows a warning if current user, company or database have been switched in another tab or window.

Table of contents

    @@ -396,7 +396,7 @@ ul.auto-toc {

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

@@ -411,6 +411,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

Contributors

@@ -420,7 +421,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/web project on GitHub.

+

This module is part of the OCA/web project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/web_switch_company_warning/static/src/js/switch_company_warning.js b/web_switch_context_warning/static/src/js/switch_company_warning.js similarity index 86% rename from web_switch_company_warning/static/src/js/switch_company_warning.js rename to web_switch_context_warning/static/src/js/switch_company_warning.js index 9327b56b..49b505ca 100644 --- a/web_switch_company_warning/static/src/js/switch_company_warning.js +++ b/web_switch_context_warning/static/src/js/switch_company_warning.js @@ -1,4 +1,4 @@ -odoo.define('web_switch_company_warning.widget', function (require) { +odoo.define('web_switch_context_warning.widget', function (require) { 'use strict'; var Widget = require('web.Widget'); @@ -12,11 +12,11 @@ odoo.define('web_switch_company_warning.widget', function (require) { return; } var SwitchCompanyWarningWidget = Widget.extend({ - template:'web_switch_company_warning.warningWidget', + template:'web_switch_context_warning.warningWidget', init: function () { this._super(); var self = this; - var w = new SharedWorker('/web_switch_company_warning/static/src/js/switch_company_warning_worker.js'); + var w = new SharedWorker('/web_switch_context_warning/static/src/js/switch_company_warning_worker.js'); w.port.addEventListener('message', function (msg) { if (msg.data.type !== 'newCtx') { return; @@ -31,7 +31,8 @@ odoo.define('web_switch_company_warning.widget', function (require) { w.port.postMessage(this.generateSignature()); }, generateSignature: function () { - return [session.company_id, session.db].join(); + console.log(session) + return [session.uid, session.company_id, session.db].join(); }, }); diff --git a/web_switch_company_warning/static/src/js/switch_company_warning_worker.js b/web_switch_context_warning/static/src/js/switch_company_warning_worker.js similarity index 100% rename from web_switch_company_warning/static/src/js/switch_company_warning_worker.js rename to web_switch_context_warning/static/src/js/switch_company_warning_worker.js diff --git a/web_switch_company_warning/static/src/xml/switch_company_warning.xml b/web_switch_context_warning/static/src/xml/switch_company_warning.xml similarity index 64% rename from web_switch_company_warning/static/src/xml/switch_company_warning.xml rename to web_switch_context_warning/static/src/xml/switch_company_warning.xml index 3bf86e9d..28b6b6c3 100644 --- a/web_switch_company_warning/static/src/xml/switch_company_warning.xml +++ b/web_switch_context_warning/static/src/xml/switch_company_warning.xml @@ -1,8 +1,8 @@