diff --git a/addons/web/static/src/views/form/form_group/form_group.js b/addons/web/static/src/views/form/form_group/form_group.js index 7be3dcd0964..cafdb5bab03 100644 --- a/addons/web/static/src/views/form/form_group/form_group.js +++ b/addons/web/static/src/views/form/form_group/form_group.js @@ -61,6 +61,10 @@ export class InnerGroup extends Group { const items = this.getItems(); while (items.length) { const [slotName, slot] = items.shift(); + if (!slot.isVisible) { + continue; + } + const { newline, itemSpan } = slot; if (newline) { rows.push(currentRow); diff --git a/addons/web/static/tests/views/form/form_view_tests.js b/addons/web/static/tests/views/form/form_view_tests.js index e1a91c70175..f39693eabc3 100644 --- a/addons/web/static/tests/views/form/form_view_tests.js +++ b/addons/web/static/tests/views/form/form_view_tests.js @@ -1941,6 +1941,31 @@ QUnit.module("Views", (hooks) => { } ); + QUnit.test( + "two mutually exclusive labels with a dynamic invisible attribute", + async function (assert) { + await makeView({ + type: "form", + resModel: "partner", + serverData, + arch: ` +
+ + + + +
`, + resId: 2, + }); + assert.containsOnce(target, "label.o_form_label", "Only one label should be displayed"); + assert.strictEqual(target.querySelector("label.o_form_label").textContent, "label2"); + assert.containsOnce(target, ".o_inner_group > div", "This group should only contain one line"); + } + ); + QUnit.test( "label is not rendered when invisible and not at top-level in a group", async function (assert) {