[FIX] web: group pager: use correct count
Steps to reproduce ================== - Go to the products list view - Remove every filter/group by - Search for "bolt" - Group by > Add Custom Group > Active - Remove the bold filter - Expand the group Cause of the issue ================== The group pager is not displayed because the condition was incorrect A group pager should only be displayed when the group limit is less than the group count. The list count was used instead, meaning the total count was the number of groups and not the number of item in the group. opw-3221226 closes odoo/odoo#117267 X-original-commit: 4caab25d182bc2b5d1a2c315795a79d286a4491e Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
This commit is contained in:
@@ -934,7 +934,7 @@ export class ListRenderer extends Component {
|
||||
return {
|
||||
offset: list.offset,
|
||||
limit: list.limit,
|
||||
total: list.count,
|
||||
total: group.count,
|
||||
onUpdate: async ({ offset, limit }) => {
|
||||
await list.load({ limit, offset });
|
||||
this.render(true);
|
||||
@@ -1654,7 +1654,7 @@ export class ListRenderer extends Component {
|
||||
}
|
||||
|
||||
showGroupPager(group) {
|
||||
return !group.isFolded && group.list.limit < group.list.count;
|
||||
return !group.isFolded && group.list.limit < group.count;
|
||||
}
|
||||
|
||||
toggleGroup(group) {
|
||||
|
||||
@@ -6091,6 +6091,51 @@ QUnit.module("Views", (hooks) => {
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"pager, grouped, group pager should update after removing a filter",
|
||||
async function (assert) {
|
||||
patchWithCleanup(DynamicRecordList, { WEB_SEARCH_READ_COUNT_LIMIT: 3 });
|
||||
serverData.models.foo.records = [
|
||||
{ id: 121, foo: "aaa" },
|
||||
{ id: 122, foo: "blip" },
|
||||
{ id: 123, foo: "blip" },
|
||||
{ id: 124, foo: "blip" },
|
||||
{ id: 125, foo: "blip" },
|
||||
{ id: 126, foo: "blip" },
|
||||
];
|
||||
await makeView({
|
||||
type: "list",
|
||||
resModel: "foo",
|
||||
serverData,
|
||||
arch: '<tree limit="2"><field name="foo"/><field name="bar"/></tree>',
|
||||
searchViewArch: `
|
||||
<search>
|
||||
<filter name="foo" domain="[('foo','=','aaa')]"/>
|
||||
<filter name="groupby_foo" context="{'group_by': 'bar'}"/>
|
||||
</search>`,
|
||||
});
|
||||
|
||||
await toggleFilterMenu(target);
|
||||
await toggleMenuItem(target, "Foo");
|
||||
|
||||
await toggleGroupByMenu(target);
|
||||
await toggleMenuItem(target, "Bar");
|
||||
|
||||
// expand group
|
||||
await click(target, "th.o_group_name");
|
||||
|
||||
assert.containsNone(target, "th.o_group_name .o_pager_counter");
|
||||
|
||||
// remove filter
|
||||
await removeFacet(target);
|
||||
|
||||
assert.strictEqual(
|
||||
$(target).find("th.o_group_name:eq(0) .o_pager_counter").text().trim(),
|
||||
"1-2 / 6"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"grouped, show only limited records when the list view is initially expanded",
|
||||
async function (assert) {
|
||||
|
||||
Reference in New Issue
Block a user