[FIX] web: multi level grouped list: do not consider empty
Before this commit, when a list view was grouped by more than 1 field, the view was considered empty, and the no content helper was displayed. For instance, go to Contacts and group by Company and Country. Part-of: odoo/odoo#133305
This commit is contained in:
@@ -36,9 +36,6 @@ export class DynamicGroupList extends DynamicList {
|
||||
}
|
||||
|
||||
get hasData() {
|
||||
if (this.count === 0) {
|
||||
return false;
|
||||
}
|
||||
return this.groups.some((group) => group.hasData);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export class Group extends DataPoint {
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
get hasData() {
|
||||
return this.list.hasData;
|
||||
return this.count > 0;
|
||||
}
|
||||
get isFolded() {
|
||||
return this.config.isFolded;
|
||||
|
||||
@@ -2195,6 +2195,24 @@ QUnit.module("Views", (hooks) => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("list view with multiple groupbys", async function (assert) {
|
||||
await makeView({
|
||||
type: "list",
|
||||
resModel: "foo",
|
||||
serverData,
|
||||
arch: '<tree><field name="foo"/><field name="bar"/></tree>',
|
||||
groupBy: ["bar", "foo"],
|
||||
noContentHelp: "<p>should not be displayed</p>",
|
||||
});
|
||||
|
||||
assert.containsNone(target, ".o_view_nocontent");
|
||||
assert.containsN(target, ".o_group_has_content", 2);
|
||||
assert.deepEqual(getNodesTextContent(target.querySelectorAll(".o_group_has_content")), [
|
||||
"No (1) ",
|
||||
"Yes (3) ",
|
||||
]);
|
||||
});
|
||||
|
||||
QUnit.test("deletion of record is disabled when groupby m2m field", async function (assert) {
|
||||
serviceRegistry.add(
|
||||
"user",
|
||||
|
||||
Reference in New Issue
Block a user