diff --git a/setup/web_select_all_companies/odoo/addons/web_select_all_companies b/setup/web_select_all_companies/odoo/addons/web_select_all_companies new file mode 120000 index 000000000..012ec121c --- /dev/null +++ b/setup/web_select_all_companies/odoo/addons/web_select_all_companies @@ -0,0 +1 @@ +../../../../web_select_all_companies \ No newline at end of file diff --git a/setup/web_select_all_companies/setup.py b/setup/web_select_all_companies/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_select_all_companies/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_select_all_companies/README.rst b/web_select_all_companies/README.rst new file mode 100644 index 000000000..6f441b66e --- /dev/null +++ b/web_select_all_companies/README.rst @@ -0,0 +1,75 @@ +======================== +Web Select All Companies +======================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/16.0/web_select_all_companies + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_select_all_companies + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/web&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to select or deselect all the companies in a single click. + +.. image:: https://raw.githubusercontent.com/OCA/web/16.0/web_select_all_companies/static/description/select_all_companies.png + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Telmo Santos + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_select_all_companies/__init__.py b/web_select_all_companies/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/web_select_all_companies/__manifest__.py b/web_select_all_companies/__manifest__.py new file mode 100644 index 000000000..91d47bb23 --- /dev/null +++ b/web_select_all_companies/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2023 Camptocamp SA - Telmo Santos +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Web Select All Companies", + "summary": "Allows you to select all companies in one click.", + "version": "16.0.1.0.0", + "category": "Web", + "website": "https://github.com/OCA/web", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "LGPL-3", + "depends": ["web"], + "assets": { + "web.assets_backend": [ + "web_select_all_companies/static/src/scss/switch_all_company_menu.scss", + "web_select_all_companies/static/src/xml/switch_all_company_menu.xml", + "web_select_all_companies/static/src/js/switch_all_company_menu.esm.js", + ], + }, + "installable": True, +} diff --git a/web_select_all_companies/i18n/fr.pot b/web_select_all_companies/i18n/fr.pot new file mode 100644 index 000000000..5e675c317 --- /dev/null +++ b/web_select_all_companies/i18n/fr.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_select_all_companies +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-02-13 07:24+0000\n" +"PO-Revision-Date: 2023-02-13 07:24+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_select_all_companies +#. odoo-javascript +#: code:addons/web_select_all_companies/static/src/xml/switch_all_company_menu.xml:0 +#, python-format +msgid "Companies" +msgstr "Sociétés" + +#. module: web_select_all_companies +#. odoo-javascript +#: code:addons/web_select_all_companies/static/src/xml/switch_all_company_menu.xml:0 +#, python-format +msgid "Select All Companies" +msgstr "Sélectionnez toutes les sociétés" diff --git a/web_select_all_companies/i18n/web_select_all_companies.pot b/web_select_all_companies/i18n/web_select_all_companies.pot new file mode 100644 index 000000000..7ab266d09 --- /dev/null +++ b/web_select_all_companies/i18n/web_select_all_companies.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_select_all_companies +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-02-13 07:24+0000\n" +"PO-Revision-Date: 2023-02-13 07:24+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_select_all_companies +#. odoo-javascript +#: code:addons/web_select_all_companies/static/src/xml/switch_all_company_menu.xml:0 +#, python-format +msgid "Companies" +msgstr "" + +#. module: web_select_all_companies +#. odoo-javascript +#: code:addons/web_select_all_companies/static/src/xml/switch_all_company_menu.xml:0 +#, python-format +msgid "Select All Companies" +msgstr "" diff --git a/web_select_all_companies/readme/CONTRIBUTORS.rst b/web_select_all_companies/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..8ed3aebac --- /dev/null +++ b/web_select_all_companies/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Telmo Santos diff --git a/web_select_all_companies/readme/DESCRIPTION.rst b/web_select_all_companies/readme/DESCRIPTION.rst new file mode 100644 index 000000000..dfdb1b993 --- /dev/null +++ b/web_select_all_companies/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows you to select or deselect all the companies in a single click. + +.. image:: ./static/description/select_all_companies.png diff --git a/web_select_all_companies/static/description/index.html b/web_select_all_companies/static/description/index.html new file mode 100644 index 000000000..0beaf24b9 --- /dev/null +++ b/web_select_all_companies/static/description/index.html @@ -0,0 +1,420 @@ + + + + + + +Web Select All Companies + + + +
+

Web Select All Companies

+ + +

Beta License: LGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

This module allows you to select or deselect all the companies in a single click.

+https://raw.githubusercontent.com/OCA/web/16.0/web_select_all_companies/static/description/select_all_companies.png +

Table of contents

+ +
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

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

+
+
+
+ + diff --git a/web_select_all_companies/static/description/select_all_companies.gif b/web_select_all_companies/static/description/select_all_companies.gif new file mode 100644 index 000000000..e9c3b35af Binary files /dev/null and b/web_select_all_companies/static/description/select_all_companies.gif differ diff --git a/web_select_all_companies/static/src/js/switch_all_company_menu.esm.js b/web_select_all_companies/static/src/js/switch_all_company_menu.esm.js new file mode 100644 index 000000000..c67fca2e5 --- /dev/null +++ b/web_select_all_companies/static/src/js/switch_all_company_menu.esm.js @@ -0,0 +1,45 @@ +/** @odoo-module **/ +/* Copyright 2023 Camptocamp - Telmo Santos + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ +import {SwitchCompanyMenu} from "@web/webclient/switch_company_menu/switch_company_menu"; +import {browser} from "@web/core/browser/browser"; +import {patch} from "@web/core/utils/patch"; + +patch(SwitchCompanyMenu.prototype, "SwitchAllCompanyMenu", { + setup() { + this._super(...arguments); + this.allCompanyIds = Object.values(this.companyService.availableCompanies).map( + (x) => x.id + ); + this.isAllCompaniesSelected = this.allCompanyIds.every((elem) => + this.selectedCompanies.includes(elem) + ); + }, + + toggleSelectAllCompanies() { + if (this.isAllCompaniesSelected) { + // Deselect all + this.state.companiesToToggle = this.allCompanyIds; + this.toggleCompany(this.currentCompany.id); + this.isAllCompaniesSelected = false; + browser.clearTimeout(this.toggleTimer); + this.toggleTimer = browser.setTimeout(() => { + this.companyService.setCompanies( + "toggle", + ...this.state.companiesToToggle + ); + }, this.constructor.toggleDelay); + } else { + // Select all + this.state.companiesToToggle = [this.allCompanyIds]; + this.isAllCompaniesSelected = true; + browser.clearTimeout(this.toggleTimer); + this.toggleTimer = browser.setTimeout(() => { + this.companyService.setCompanies( + "loginto", + ...this.state.companiesToToggle + ); + }, this.constructor.toggleDelay); + } + }, +}); diff --git a/web_select_all_companies/static/src/scss/switch_all_company_menu.scss b/web_select_all_companies/static/src/scss/switch_all_company_menu.scss new file mode 100644 index 000000000..bf6cb0fcc --- /dev/null +++ b/web_select_all_companies/static/src/scss/switch_all_company_menu.scss @@ -0,0 +1,4 @@ +.all-companies-item { + font-size: 16px; + font-weight: bold; +} diff --git a/web_select_all_companies/static/src/xml/switch_all_company_menu.xml b/web_select_all_companies/static/src/xml/switch_all_company_menu.xml new file mode 100644 index 000000000..05bb2ecea --- /dev/null +++ b/web_select_all_companies/static/src/xml/switch_all_company_menu.xml @@ -0,0 +1,39 @@ + + + + + +
+
+ + + +
+
+ Companies +
+
+
+
+
+