diff --git a/web_group_expand/README.rst b/web_group_expand/README.rst
index e9fd1f871..340574ce1 100644
--- a/web_group_expand/README.rst
+++ b/web_group_expand/README.rst
@@ -14,13 +14,13 @@ Group Expand Buttons
: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/14.0/web_group_expand
+ :target: https://github.com/OCA/web/tree/15.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-14-0/web-14-0-web_group_expand
+ :target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_group_expand
: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/14.0
+ :target: https://runbot.odoo-community.org/runbot/162/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -43,7 +43,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.
@@ -83,6 +83,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_group_expand/__manifest__.py b/web_group_expand/__manifest__.py
index 8d12ab643..41f808503 100644
--- a/web_group_expand/__manifest__.py
+++ b/web_group_expand/__manifest__.py
@@ -1,7 +1,7 @@
{
"name": "Group Expand Buttons",
"category": "Web",
- "version": "14.0.1.0.0",
+ "version": "15.0.1.0.0",
"license": "AGPL-3",
"author": "OpenERP SA, "
"AvanzOSC, "
@@ -11,6 +11,12 @@
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"depends": ["web"],
- "qweb": ["static/src/xml/expand_buttons.xml"],
- "data": ["views/templates.xml"],
+ "assets": {
+ "web.assets_backend": [
+ "/web_group_expand/static/src/js/web_group_expand.esm.js",
+ ],
+ "web.assets_qweb": [
+ "/web_group_expand/static/src/xml/expand_buttons.xml",
+ ],
+ },
}
diff --git a/web_group_expand/i18n/web_group_expand.pot b/web_group_expand/i18n/web_group_expand.pot
index de8f11934..b9f98d1e4 100644
--- a/web_group_expand/i18n/web_group_expand.pot
+++ b/web_group_expand/i18n/web_group_expand.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
diff --git a/web_group_expand/static/description/index.html b/web_group_expand/static/description/index.html
index 785f7be45..5e91c6b7f 100644
--- a/web_group_expand/static/description/index.html
+++ b/web_group_expand/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

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.
@@ -389,7 +389,7 @@ collapse all the groups at once.
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.
@@ -423,7 +423,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_group_expand/static/src/js/web_group_expand.esm.js b/web_group_expand/static/src/js/web_group_expand.esm.js
new file mode 100644
index 000000000..ab85b503e
--- /dev/null
+++ b/web_group_expand/static/src/js/web_group_expand.esm.js
@@ -0,0 +1,91 @@
+/** @odoo-module */
+
+import ListController from "web.ListController";
+import ListRenderer from "web.ListRenderer";
+import core from "web.core";
+
+const qweb = core.qweb;
+
+ListController.include({
+ start: function () {
+ this.$expandGroupButtons = $(qweb.render("web_group_expand.Buttons"));
+ this.$expandGroupButtons
+ .find("#oe_group_by_expand")
+ .on("click", this.expandAllGroups.bind(this));
+ this.$expandGroupButtons
+ .find("#oe_group_by_collapse")
+ .on("click", this.collapseAllGroups.bind(this));
+ return this._super.apply(this, arguments);
+ },
+
+ renderButtons: function () {
+ this._super.apply(this, arguments);
+ this.$expandGroupButtons.toggleClass("o_hidden", !this.renderer.isGrouped);
+ this.$buttons.append(this.$expandGroupButtons);
+ },
+
+ expandAllGroups: function () {
+ // We expand layer by layer. So first we need to find the highest
+ // layer that's not already fully expanded.
+ let layer = this.renderer.state.data;
+ while (layer.length) {
+ const closed = layer.filter(function (group) {
+ return !group.isOpen;
+ });
+ if (closed.length) {
+ // This layer is not completely expanded, expand it
+ this._toggleGroups(closed);
+ break;
+ }
+ // This layer is completely expanded, move to the next
+ layer = _.flatten(
+ layer.map(function (group) {
+ return group.data;
+ }),
+ true
+ );
+ }
+ },
+
+ collapseAllGroups: function () {
+ // We collapse layer by layer. So first we need to find the deepest
+ // layer that's not already fully collapsed.
+ let layer = this.renderer.state.data.filter(function (group) {
+ return group.isOpen;
+ });
+ while (layer.length) {
+ const next = _.flatten(
+ layer.map(function (group) {
+ return group.data;
+ }),
+ true
+ ).filter(function (group) {
+ return group.isOpen;
+ });
+ if (!next.length) {
+ // Next layer is fully collapsed, so collapse this one
+ this._toggleGroups(layer);
+ break;
+ }
+ layer = next;
+ }
+ },
+
+ _toggleGroups: function (groups) {
+ const self = this;
+ const defs = groups.map(function (group) {
+ return self.model.toggleGroup(group.id);
+ });
+ $.when(...defs).then(
+ this.update.bind(this, {}, {keepSelection: true, reload: false})
+ );
+ },
+});
+
+ListRenderer.include({
+ updateState: function () {
+ const res = this._super.apply(this, arguments);
+ $("nav.oe_group_by_expand_buttons").toggleClass("o_hidden", !this.isGrouped);
+ return res;
+ },
+});
diff --git a/web_group_expand/static/src/js/web_group_expand.js b/web_group_expand/static/src/js/web_group_expand.js
deleted file mode 100644
index cc30f75ce..000000000
--- a/web_group_expand/static/src/js/web_group_expand.js
+++ /dev/null
@@ -1,92 +0,0 @@
-odoo.define("web.web_group_expand", function (require) {
- "use strict";
-
- var qweb = require("web.core").qweb;
-
- require("web.ListController").include({
- start: function () {
- this.$expandGroupButtons = $(qweb.render("web_group_expand.Buttons"));
- this.$expandGroupButtons
- .find("#oe_group_by_expand")
- .on("click", this.expandAllGroups.bind(this));
- this.$expandGroupButtons
- .find("#oe_group_by_collapse")
- .on("click", this.collapseAllGroups.bind(this));
- return this._super.apply(this, arguments);
- },
-
- renderButtons: function () {
- this._super.apply(this, arguments);
- this.$expandGroupButtons.toggleClass("o_hidden", !this.renderer.isGrouped);
- this.$buttons.append(this.$expandGroupButtons);
- },
-
- expandAllGroups: function () {
- // We expand layer by layer. So first we need to find the highest
- // layer that's not already fully expanded.
- var layer = this.renderer.state.data;
- while (layer.length) {
- var closed = layer.filter(function (group) {
- return !group.isOpen;
- });
- if (closed.length) {
- // This layer is not completely expanded, expand it
- this._toggleGroups(closed);
- break;
- }
- // This layer is completely expanded, move to the next
- layer = _.flatten(
- layer.map(function (group) {
- return group.data;
- }),
- true
- );
- }
- },
-
- collapseAllGroups: function () {
- // We collapse layer by layer. So first we need to find the deepest
- // layer that's not already fully collapsed.
- var layer = this.renderer.state.data.filter(function (group) {
- return group.isOpen;
- });
- while (layer.length) {
- var next = _.flatten(
- layer.map(function (group) {
- return group.data;
- }),
- true
- ).filter(function (group) {
- return group.isOpen;
- });
- if (!next.length) {
- // Next layer is fully collapsed, so collapse this one
- this._toggleGroups(layer);
- break;
- }
- layer = next;
- }
- },
-
- _toggleGroups: function (groups) {
- var self = this;
- var defs = groups.map(function (group) {
- return self.model.toggleGroup(group.id);
- });
- $.when(...defs).then(
- this.update.bind(this, {}, {keepSelection: true, reload: false})
- );
- },
- });
-
- require("web.ListRenderer").include({
- updateState: function () {
- var res = this._super.apply(this, arguments);
- $("nav.oe_group_by_expand_buttons").toggleClass(
- "o_hidden",
- !this.isGrouped
- );
- return res;
- },
- });
-});
diff --git a/web_group_expand/views/templates.xml b/web_group_expand/views/templates.xml
deleted file mode 100644
index 9a2baa5ba..000000000
--- a/web_group_expand/views/templates.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-