[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>
This commit is contained in:
@@ -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));
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -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>', {
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user