diff --git a/web_select_all_companies/README.rst b/web_select_all_companies/README.rst index 816a9db0d04b..c75b30b1b2ae 100644 --- a/web_select_all_companies/README.rst +++ b/web_select_all_companies/README.rst @@ -57,11 +57,13 @@ Authors ------- * Camptocamp +* Alitec Pte Ltd Contributors ------------ - Telmo Santos +- Jay Patel Maintainers ----------- diff --git a/web_select_all_companies/__manifest__.py b/web_select_all_companies/__manifest__.py index d2a190187ab3..394e8b3a2f4c 100644 --- a/web_select_all_companies/__manifest__.py +++ b/web_select_all_companies/__manifest__.py @@ -1,18 +1,18 @@ # Copyright 2023 Camptocamp SA - Telmo Santos +# Copyright 2024 Alitec Pte Ltd - Jay Patel # 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.1", + "version": "17.0.1.0.1", "category": "Web", "website": "https://github.com/OCA/web", - "author": "Camptocamp, Odoo Community Association (OCA)", + "author": "Camptocamp, Alitec Pte Ltd, 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", ], diff --git a/web_select_all_companies/readme/CONTRIBUTORS.md b/web_select_all_companies/readme/CONTRIBUTORS.md index d65a531f37f4..cd926da0a166 100644 --- a/web_select_all_companies/readme/CONTRIBUTORS.md +++ b/web_select_all_companies/readme/CONTRIBUTORS.md @@ -1 +1,2 @@ - Telmo Santos \<\> +- Jay Patel \<\> diff --git a/web_select_all_companies/static/description/index.html b/web_select_all_companies/static/description/index.html index d604a3887ac9..928d42cfc247 100644 --- a/web_select_all_companies/static/description/index.html +++ b/web_select_all_companies/static/description/index.html @@ -399,12 +399,14 @@

Credits

Authors

  • Camptocamp
  • +
  • Alitec Pte Ltd
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 index c67fca2e59eb..4387750d752f 100644 --- 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 @@ -1,44 +1,38 @@ /** @odoo-module **/ -/* Copyright 2023 Camptocamp - Telmo Santos - * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ +/* + Copyright 2023 Camptocamp - Telmo Santos + Copyright 2024 Alitec Pte Ltd (https://www.alitec.sg) - Jay Patel + * 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", { +patch(SwitchCompanyMenu.prototype, { setup() { - this._super(...arguments); - this.allCompanyIds = Object.values(this.companyService.availableCompanies).map( + super.setup(); + this.allCompanyIds = Object.values(this.companyService.allowedCompanies).map( (x) => x.id ); this.isAllCompaniesSelected = this.allCompanyIds.every((elem) => - this.selectedCompanies.includes(elem) + this.companySelector.selectedCompaniesIds.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); + this.companySelector.switchCompany( + "loginto", + this.companyService.currentCompany.id + ); } else { // Select all - this.state.companiesToToggle = [this.allCompanyIds]; + const companiesToToggle = this.allCompanyIds; this.isAllCompaniesSelected = true; browser.clearTimeout(this.toggleTimer); this.toggleTimer = browser.setTimeout(() => { - this.companyService.setCompanies( - "loginto", - ...this.state.companiesToToggle - ); + this.companyService.setCompanies(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 deleted file mode 100644 index bf6cb0fcced7..000000000000 --- a/web_select_all_companies/static/src/scss/switch_all_company_menu.scss +++ /dev/null @@ -1,4 +0,0 @@ -.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 index 0b535b4142c2..c02e1a9b13eb 100644 --- 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 @@ -7,18 +7,18 @@ owl="1" > - +
- + @@ -26,11 +26,14 @@
- All Companies + All Companies