From 56c576208a74c2b4ae31a110d6c88244244f0927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Gil=20Sorribes?= Date: Fri, 14 Jun 2019 13:33:03 +0200 Subject: [PATCH] [IMP] add user switch detection and rename module --- .../readme/CONTRIBUTORS.rst | 1 - .../readme/DESCRIPTION.rst | 1 - .../README.rst | 19 +++++++++--------- .../__init__.py | 0 .../__manifest__.py | 10 ++++----- .../i18n/web_switch_company_warning.pot | 0 .../readme/CONTRIBUTORS.rst | 2 ++ .../readme/DESCRIPTION.rst | 1 + .../readme/ROADMAP.rst | 2 +- .../readme/USAGE.rst | 0 .../static/description/icon.png | Bin .../static/description/index.html | 17 ++++++++-------- .../static/src/js/switch_context_warning.js | 10 ++++----- .../src/js/switch_context_warning_worker.js | 2 +- .../static/src/xml/switch_context_warning.xml | 4 ++-- .../view/view.xml | 4 ++-- 16 files changed, 38 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 (80%) rename {web_switch_company_warning => web_switch_context_warning}/__init__.py (100%) rename {web_switch_company_warning => web_switch_context_warning}/__manifest__.py (64%) rename {web_switch_company_warning => web_switch_context_warning}/i18n/web_switch_company_warning.pot (100%) 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 (53%) 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 (92%) rename web_switch_company_warning/static/src/js/switch_company_warning.js => web_switch_context_warning/static/src/js/switch_context_warning.js (76%) rename web_switch_company_warning/static/src/js/switch_company_warning_worker.js => web_switch_context_warning/static/src/js/switch_context_warning_worker.js (89%) rename web_switch_company_warning/static/src/xml/switch_company_warning.xml => web_switch_context_warning/static/src/xml/switch_context_warning.xml (66%) 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 80% rename from web_switch_company_warning/README.rst rename to web_switch_context_warning/README.rst index 03aa5afa..c27c58a8 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/12.0/web_switch_company_warning + :target: https://github.com/OCA/web/tree/12.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-12-0/web-12-0-web_switch_company_warning + :target: https://translation.odoo-community.org/projects/web-12-0/web-12-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/12.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** @@ -35,7 +35,7 @@ Shows a warning if current company has been switched in another tab or window. Known issues / Roadmap ====================== - * 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 Shared 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 Worker(limit to browser session, server:port...) @@ -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 64% rename from web_switch_company_warning/__manifest__.py rename to web_switch_context_warning/__manifest__.py index f7f5e13c..275a5233 100644 --- a/web_switch_company_warning/__manifest__.py +++ b/web_switch_context_warning/__manifest__.py @@ -1,10 +1,10 @@ # 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.", - "version": "12.0.1.0.0", + "name": "Switch Context Warning", + "summary": "Show a warning if current user, company or database " + "have been switched in another tab or window.", + "version": "12.0.2.0.0", "category": "web", "website": "https://github.com/OCA/web", "license": "AGPL-3", @@ -17,7 +17,7 @@ "view/view.xml", ], "qweb": [ - "static/src/xml/switch_company_warning.xml", + "static/src/xml/switch_context_warning.xml", ], 'installable': True, "application": False, 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 100% rename from web_switch_company_warning/i18n/web_switch_company_warning.pot rename to web_switch_context_warning/i18n/web_switch_company_warning.pot 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 53% rename from web_switch_company_warning/readme/ROADMAP.rst rename to web_switch_context_warning/readme/ROADMAP.rst index cbb4925b..7a5a6531 100644 --- a/web_switch_company_warning/readme/ROADMAP.rst +++ b/web_switch_context_warning/readme/ROADMAP.rst @@ -1,3 +1,3 @@ - * 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 Shared 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 Worker(limit to browser session, server:port...) 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 92% rename from web_switch_company_warning/static/description/index.html rename to web_switch_context_warning/static/description/index.html index c34ecc47..b27a00db 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

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

    Known issues / Roadmap

      -
    • 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 Shared 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 Worker(limit to browser session, server:port…)
    @@ -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_context_warning.js similarity index 76% rename from web_switch_company_warning/static/src/js/switch_company_warning.js rename to web_switch_context_warning/static/src/js/switch_context_warning.js index 820f3700..2c868ce0 100644 --- a/web_switch_company_warning/static/src/js/switch_company_warning.js +++ b/web_switch_context_warning/static/src/js/switch_context_warning.js @@ -1,10 +1,10 @@ -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'); 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 + // Show a big banner in the top of the page if the context has been // changed in another tab or window (in the same browser) if (!window.SharedWorker) { @@ -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_context_warning_worker.js'); w.port.addEventListener('message', function (msg) { if (msg.data.type !== 'newCtx') { return; @@ -31,7 +31,7 @@ odoo.define('web_switch_company_warning.widget', function (require) { w.port.postMessage(this.generateSignature()); }, generateSignature: function () { - return [session.company_id, session.db].join(); + 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_context_warning_worker.js similarity index 89% rename from web_switch_company_warning/static/src/js/switch_company_warning_worker.js rename to web_switch_context_warning/static/src/js/switch_context_warning_worker.js index dd8a0860..901239a7 100644 --- a/web_switch_company_warning/static/src/js/switch_company_warning_worker.js +++ b/web_switch_context_warning/static/src/js/switch_context_warning_worker.js @@ -1,4 +1,4 @@ -// Show a big banner in the top of the page if the company has been +// Show a big banner in the top of the page if the context has been // Changed in another tab or window (in the same browser) var con = []; diff --git a/web_switch_company_warning/static/src/xml/switch_company_warning.xml b/web_switch_context_warning/static/src/xml/switch_context_warning.xml similarity index 66% rename from web_switch_company_warning/static/src/xml/switch_company_warning.xml rename to web_switch_context_warning/static/src/xml/switch_context_warning.xml index 4a140079..ee02d017 100644 --- a/web_switch_company_warning/static/src/xml/switch_company_warning.xml +++ b/web_switch_context_warning/static/src/xml/switch_context_warning.xml @@ -1,8 +1,8 @@