diff --git a/web_group_expand/README.rst b/web_group_expand/README.rst new file mode 100644 index 000000000000..316fe0e38b13 --- /dev/null +++ b/web_group_expand/README.rst @@ -0,0 +1,95 @@ +==================== +Group Expand Buttons +==================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:b5fde9f965d20bdbf8c43c31517883b9d540f190b20715d4a86e09a7b8a774ad + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-AGPL--3-blue.png + :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/18.0/web_group_expand + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_group_expand + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +When grouping a list by a field, this module adds two buttons to expand +or collapse all the groups at once. + +The buttons appear in the top right, in place of the pagination. + +One level of groups is expanded or collapsed at a time. + +**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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* OpenERP SA +* AvanzOSC +* Serv. Tecnol. Avanzados - Pedro M. Baeza +* Therp BV +* Xtendoo + +Contributors +------------ + +- Mantavya Gajjar +- Oihane Crucelaegui +- Pedro M. Baeza +- Jay Vora (SerpentCS) for their alternative implementation +- Jan Verbeek +- Manuel Calero +- Alvaro Estebanez (brain-tec AG) +- Mayank Patel +- `360ERP `__: + + - Andrea Stirpe + +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_group_expand/__init__.py b/web_group_expand/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/web_group_expand/__manifest__.py b/web_group_expand/__manifest__.py new file mode 100644 index 000000000000..b084fdd3b478 --- /dev/null +++ b/web_group_expand/__manifest__.py @@ -0,0 +1,20 @@ +{ + "name": "Group Expand Buttons", + "category": "Web", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "author": "OpenERP SA, " + "AvanzOSC, " + "Serv. Tecnol. Avanzados - Pedro M. Baeza, " + "Therp BV, " + "Xtendoo, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "depends": ["web"], + "assets": { + "web.assets_backend": [ + "/web_group_expand/static/src/xml/list_controller.xml", + "/web_group_expand/static/src/js/list_controller.esm.js", + ], + }, +} diff --git a/web_group_expand/i18n/ca.po b/web_group_expand/i18n/ca.po new file mode 100644 index 000000000000..5ceccdb4035c --- /dev/null +++ b/web_group_expand/i18n/ca.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_group_expand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-02-17 10:45+0000\n" +"Last-Translator: claudiagn \n" +"Language-Team: none\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Compress" +msgstr "" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Expand" +msgstr "" + +#, python-format +#~ msgid "Collapse groups" +#~ msgstr "Col·lapsar grups" + +#, python-format +#~ msgid "Expand groups" +#~ msgstr "Expandir grups" diff --git a/web_group_expand/i18n/de.po b/web_group_expand/i18n/de.po new file mode 100644 index 000000000000..dee839c1c609 --- /dev/null +++ b/web_group_expand/i18n/de.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_group_expand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-10-13 20:46+0000\n" +"Last-Translator: Corneliuus \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Compress" +msgstr "" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Expand" +msgstr "" + +#, python-format +#~ msgid "Collapse groups" +#~ msgstr "Gruppen einklappen" + +#, python-format +#~ msgid "Expand groups" +#~ msgstr "Gruppen ausklappen" diff --git a/web_group_expand/i18n/es.po b/web_group_expand/i18n/es.po new file mode 100644 index 000000000000..ee16cdbd95bf --- /dev/null +++ b/web_group_expand/i18n/es.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_group_expand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-10-08 23:01+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Compress" +msgstr "Comprimir" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Expand" +msgstr "Ampliar" + +#, python-format +#~ msgid "Collapse groups" +#~ msgstr "Colapsar grupos" + +#, python-format +#~ msgid "Expand groups" +#~ msgstr "Expandir grupos" diff --git a/web_group_expand/i18n/it.po b/web_group_expand/i18n/it.po new file mode 100644 index 000000000000..fd6ed615c2d0 --- /dev/null +++ b/web_group_expand/i18n/it.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_group_expand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-11-27 11:34+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Compress" +msgstr "Comprimi" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Expand" +msgstr "Espandi" diff --git a/web_group_expand/i18n/nl.po b/web_group_expand/i18n/nl.po new file mode 100644 index 000000000000..daa246336750 --- /dev/null +++ b/web_group_expand/i18n/nl.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_group_expand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-04-20 10:58+0000\n" +"PO-Revision-Date: 2020-04-20 12:59+0200\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Compress" +msgstr "" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Expand" +msgstr "" + +#, python-format +#~ msgid "Collapse groups" +#~ msgstr "Groepen inklappen" + +#, python-format +#~ msgid "Expand groups" +#~ msgstr "Groepen uitvouwen" diff --git a/web_group_expand/i18n/pt_BR.po b/web_group_expand/i18n/pt_BR.po new file mode 100644 index 000000000000..89dbe48ed1cf --- /dev/null +++ b/web_group_expand/i18n/pt_BR.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_group_expand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-10-28 16:10+0000\n" +"Last-Translator: Adriano Prado \n" +"Language-Team: none\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Compress" +msgstr "Comprimir" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Expand" +msgstr "Expandir" + +#, python-format +#~ msgid "Collapse groups" +#~ msgstr "Recolher grupos" + +#, python-format +#~ msgid "Expand groups" +#~ msgstr "Expandir grupos" diff --git a/web_group_expand/i18n/web_group_expand.pot b/web_group_expand/i18n/web_group_expand.pot new file mode 100644 index 000000000000..5a07e3b0703e --- /dev/null +++ b/web_group_expand/i18n/web_group_expand.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_group_expand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \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_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Compress" +msgstr "" + +#. module: web_group_expand +#. odoo-javascript +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0 +#, python-format +msgid "Expand" +msgstr "" diff --git a/web_group_expand/pyproject.toml b/web_group_expand/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/web_group_expand/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_group_expand/readme/CONTRIBUTORS.md b/web_group_expand/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..46e5537110e4 --- /dev/null +++ b/web_group_expand/readme/CONTRIBUTORS.md @@ -0,0 +1,10 @@ +- Mantavya Gajjar \<\> +- Oihane Crucelaegui \<\> +- Pedro M. Baeza \<\> +- Jay Vora (SerpentCS) for their alternative implementation +- Jan Verbeek \<\> +- Manuel Calero \<\> +- Alvaro Estebanez (brain-tec AG) \<\> +- Mayank Patel \<\> +- [360ERP](https://www.360erp.com): + - Andrea Stirpe diff --git a/web_group_expand/readme/DESCRIPTION.md b/web_group_expand/readme/DESCRIPTION.md new file mode 100644 index 000000000000..7255e7128368 --- /dev/null +++ b/web_group_expand/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +When grouping a list by a field, this module adds two buttons to expand +or collapse all the groups at once. + +The buttons appear in the top right, in place of the pagination. + +One level of groups is expanded or collapsed at a time. diff --git a/web_group_expand/static/description/icon.png b/web_group_expand/static/description/icon.png new file mode 100644 index 000000000000..775a5935375d Binary files /dev/null and b/web_group_expand/static/description/icon.png differ diff --git a/web_group_expand/static/description/index.html b/web_group_expand/static/description/index.html new file mode 100644 index 000000000000..60ea522dd084 --- /dev/null +++ b/web_group_expand/static/description/index.html @@ -0,0 +1,441 @@ + + + + + +Group Expand Buttons + + + +
+

Group Expand Buttons

+ + +

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

+

When grouping a list by a field, this module adds two buttons to expand +or collapse all the groups at once.

+

The buttons appear in the top right, in place of the pagination.

+

One level of groups is expanded or collapsed at a time.

+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • OpenERP SA
  • +
  • AvanzOSC
  • +
  • Serv. Tecnol. Avanzados - Pedro M. Baeza
  • +
  • Therp BV
  • +
  • Xtendoo
  • +
+
+
+

Contributors

+ +
+
+

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_group_expand/static/src/js/list_controller.esm.js b/web_group_expand/static/src/js/list_controller.esm.js new file mode 100644 index 000000000000..a55829e1ce03 --- /dev/null +++ b/web_group_expand/static/src/js/list_controller.esm.js @@ -0,0 +1,61 @@ +import {ListController} from "@web/views/list/list_controller"; +import {patch} from "@web/core/utils/patch"; + +function flatten(arr) { + return arr.reduce((flat, toFlatten) => { + return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten); + }, []); +} + +patch(ListController.prototype, { + async expandAllGroups() { + // We expand layer by layer. So first we need to find the highest + // layer that's not already fully expanded. + let layer = this.model.root.groups; + while (layer.length) { + const closed = layer.filter(function (group) { + return group._config.isFolded; + }); + if (closed.length) { + // This layer is not completely expanded, expand it + await layer.forEach((group) => { + group._config.isFolded = false; + }); + break; + } + // This layer is completely expanded, move to the next + layer = flatten( + layer.map(function (group) { + return group.list.groups || []; + }) + ); + } + await this.model.root.load(); + this.model.notify(); + }, + + async collapseAllGroups() { + // We collapse layer by layer. So first we need to find the deepest + // layer that's not already fully collapsed. + let layer = this.model.root.groups; + while (layer.length) { + const next = flatten( + layer.map(function (group) { + return group.list.groups || []; + }) + ).filter(function (group) { + return !group._config.isFolded; + }); + if (!next.length) { + // Next layer is fully collapsed, so collapse this one + await layer.forEach((group) => { + group._config.isFolded = true; + }); + break; + } + layer = next; + } + await this.model.root.load(); + this.model.notify(); + }, +}); diff --git a/web_group_expand/static/src/xml/list_controller.xml b/web_group_expand/static/src/xml/list_controller.xml new file mode 100644 index 000000000000..743b8aa35c51 --- /dev/null +++ b/web_group_expand/static/src/xml/list_controller.xml @@ -0,0 +1,23 @@ + + + + + +