diff --git a/addons/web/static/src/views/list/list_renderer.js b/addons/web/static/src/views/list/list_renderer.js
index 8fbf3544d49..12d8b047259 100644
--- a/addons/web/static/src/views/list/list_renderer.js
+++ b/addons/web/static/src/views/list/list_renderer.js
@@ -1012,23 +1012,24 @@ export class ListRenderer extends Component {
if (this.hasSelectors) {
colspan++;
}
- if (this.props.onOpenFormView) {
- colspan++;
- }
return colspan;
}
getGroupPagerCellColspan(group) {
const lastAggregateIndex = this.getLastAggregateIndex(group);
+ let colspan;
if (lastAggregateIndex > -1) {
- let colspan = this.state.columns.length - lastAggregateIndex - 1;
+ colspan = this.state.columns.length - lastAggregateIndex - 1;
if (this.displayOptionalFields) {
colspan++;
}
- return colspan;
} else {
- return this.state.columns.length > 1 ? DEFAULT_GROUP_PAGER_COLSPAN : 0;
+ colspan = this.state.columns.length > 1 ? DEFAULT_GROUP_PAGER_COLSPAN : 0;
}
+ if (this.props.onOpenFormView) {
+ colspan++;
+ }
+ return colspan
}
getGroupPagerProps(group) {
diff --git a/addons/web/static/tests/views/list_view_tests.js b/addons/web/static/tests/views/list_view_tests.js
index 8ac94b40b69..cdc111b166a 100644
--- a/addons/web/static/tests/views/list_view_tests.js
+++ b/addons/web/static/tests/views/list_view_tests.js
@@ -2141,6 +2141,60 @@ QUnit.module("Views", (hooks) => {
}
);
+ QUnit.test(
+ "basic grouped list rendering 4 cols with aggregates, selector and openFormView",
+ async function (assert) {
+ await makeView({
+ type: "list",
+ resModel: "foo",
+ serverData,
+ arch: `
+
+
+
+
+
+ `,
+ groupBy: ["bar"],
+ });
+
+ assert.strictEqual(
+ target.querySelector(".o_group_header th").getAttribute("colspan"), "2"
+ );
+ assert.strictEqual(
+ target.querySelector(".o_group_header th:last-child").getAttribute("colspan"),
+ "2",
+ );
+ }
+ );
+
+ QUnit.test(
+ "basic grouped list rendering 4 cols with aggregates, selector, optional and openFormView",
+ async function (assert) {
+ await makeView({
+ type: "list",
+ resModel: "foo",
+ serverData,
+ arch: `
+
+
+
+
+
+ `,
+ groupBy: ["bar"],
+ });
+
+ assert.strictEqual(
+ target.querySelector(".o_group_header th").getAttribute("colspan"), "2"
+ );
+ assert.strictEqual(
+ target.querySelector(".o_group_header th:last-child").getAttribute("colspan"),
+ "1",
+ );
+ }
+ );
+
QUnit.test("group a list view with the aggregable field 'value'", async function (assert) {
serverData.models.foo.fields.value = {
string: "Value",