[FIX] web: InnerGroup: a row can have visible and invisible cells
Have an InnerGroup which has a first div visible all the time and a second div conditionally invisible. Before this commit, when the second div was invisible, the first was not displayed. After this commit, the two divs are displayed correctly. X-original-commit: c69836e3c53e1efb61f66612c266a31aa9b54816 Part-of: odoo/odoo#102578
This commit is contained in:
@@ -81,7 +81,7 @@ export class InnerGroup extends Group {
|
||||
reservedSpace += itemSpan || 1;
|
||||
|
||||
// Allows to remove the line if the content is not visible instead of leaving an empty line.
|
||||
currentRow.isVisible = isVisible;
|
||||
currentRow.isVisible = currentRow.isVisible || isVisible;
|
||||
}
|
||||
rows.push(currentRow);
|
||||
|
||||
|
||||
@@ -8431,6 +8431,37 @@ QUnit.module("Views", (hooks) => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("inner group with invisible cells", async (assert) => {
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<field name="foo" />
|
||||
<group>
|
||||
<div class="cell1" attrs='{"invisible": [["foo", "=", "1"]]}' />
|
||||
<div class="cell2" attrs='{"invisible": [["foo", "=", "2"]]}' />
|
||||
</group>
|
||||
</form>`,
|
||||
});
|
||||
|
||||
await editInput(target, "[name='foo'] input", 1);
|
||||
assert.containsOnce(target, ".o_wrap_field");
|
||||
assert.containsNone(target, ".o_wrap_field .cell1");
|
||||
assert.containsOnce(target, ".o_wrap_field .cell2");
|
||||
|
||||
await editInput(target, "[name='foo'] input", 2);
|
||||
assert.containsOnce(target, ".o_wrap_field");
|
||||
assert.containsOnce(target, ".o_wrap_field .cell1");
|
||||
assert.containsNone(target, ".o_wrap_field .cell2");
|
||||
|
||||
await editInput(target, "[name='foo'] input", 3);
|
||||
assert.containsOnce(target, ".o_wrap_field");
|
||||
assert.containsOnce(target, ".o_wrap_field .cell1");
|
||||
assert.containsOnce(target, ".o_wrap_field .cell2");
|
||||
});
|
||||
|
||||
QUnit.test("form group with newline tag inside", async function (assert) {
|
||||
await makeView({
|
||||
type: "form",
|
||||
|
||||
Reference in New Issue
Block a user