summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2019-07-23 08:08:03 +0000
committerGéry Debongnie <ged@odoo.com>2019-07-23 08:09:50 +0000
commit4e6ee3ac97041653ff15a77abd77084dc0c9f525 (patch)
treebe02c48ed0207a2109d45f744c438b2197cc261e
parentfe4caecb59dd9a4456bbf40563a842ca7e318307 (diff)
[FIX] web: allow groupby buttons in list view at any level
The initial implementation of the special group by buttons in list groups only supported the first level of groupby. So, if one grouped a list view by field A, it worked (if A had a groupby defined). However, if we want to group by B/A, this no longer works. opw 2040725 closes odoo/odoo#35090 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
-rw-r--r--addons/web/static/src/js/views/list/list_model.js9
-rw-r--r--addons/web/static/src/js/views/list/list_renderer.js2
-rw-r--r--addons/web/static/tests/views/list_tests.js4
-rw-r--r--doc/reference/views.rst2
4 files changed, 5 insertions, 12 deletions
diff --git a/addons/web/static/src/js/views/list/list_model.js b/addons/web/static/src/js/views/list/list_model.js
index 41178498c96..6c592bd977e 100644
--- a/addons/web/static/src/js/views/list/list_model.js
+++ b/addons/web/static/src/js/views/list/list_model.js
@@ -94,14 +94,7 @@ odoo.define('web.ListModel', function (require) {
options = options || {};
options.fetchRecordsWithGroups = true;
return this._super(list, options).then(function (result) {
- var prom;
- if (!list.parentID) {
- // groupbys buttons are only displayed on the first level of
- // groupby so no need to fetch the extra fields for inner
- // groups
- prom = self._readGroupExtraFields(list);
- }
- return Promise.resolve(prom).then(_.constant(result));
+ return self._readGroupExtraFields(list).then(_.constant(result));
});
},
/**
diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js
index 364c663d117..658319fc2e7 100644
--- a/addons/web/static/src/js/views/list/list_renderer.js
+++ b/addons/web/static/src/js/views/list/list_renderer.js
@@ -579,7 +579,7 @@ var ListRenderer = BasicRenderer.extend({
var $pager = this._renderGroupPager(group);
$lastCell.addClass('o_group_pager').append($pager);
}
- if (groupLevel === 0 && group.isOpen && this.groupbys[groupBy]) {
+ if (group.isOpen && this.groupbys[groupBy]) {
var $buttons = this._renderGroupButtons(group, this.groupbys[groupBy]);
if ($buttons.length) {
var $buttonSection = $('<div>', {
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js
index 2c7ce0bacec..aed485aad66 100644
--- a/addons/web/static/tests/views/list_tests.js
+++ b/addons/web/static/tests/views/list_tests.js
@@ -2039,8 +2039,8 @@ QUnit.module('Views', {
await testUtils.dom.click(list.$('tbody:eq(1) .o_group_header:eq(0)'));
- assert.containsNone(list, '.o_group_header button',
- "there should be no button in the header");
+ assert.containsOnce(list, '.o_group_header button',
+ "there should be one button in the header");
list.destroy();
});
diff --git a/doc/reference/views.rst b/doc/reference/views.rst
index 56dca21bf1d..b3504add3c1 100644
--- a/doc/reference/views.rst
+++ b/doc/reference/views.rst
@@ -345,7 +345,7 @@ Possible children elements of the list view are:
``name``
the name of a many2one field (on the current model). Custom header will be
- displayed when grouping the view on this field name (only for first level).
+ displayed when grouping the view on this field name.
.. code-block:: xml