Skip to content

Commit 2a6303d

Browse files
committed
[FIX] Grid: hide the table resizer in readonly mode
the table resizer handler was present in readonly mode which is useless since the user cannot edit the spreadsheet and therefore change the table size. closes #8306 Task: 6054035 X-original-commit: 92da1ba Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com> Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
1 parent 82ddc01 commit 2a6303d

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/components/grid/grid.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@
5757
anchorRect="menuState.anchorRect"
5858
onClose="() => this.closeMenu()"
5959
/>
60-
<t t-foreach="staticTables" t-as="table" t-key="table.id">
60+
<t
61+
t-if="!env.model.getters.isReadonly()"
62+
t-foreach="staticTables"
63+
t-as="table"
64+
t-key="table.id">
6165
<TableResizer table="table"/>
6266
</t>
6367
<VerticalScrollBar topOffset="HEADER_HEIGHT"/>

tests/table/table_resizer_component.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,13 @@ describe("Table resizer component", () => {
105105

106106
expect(document.querySelector(".o-table-resizer")).toBeNull();
107107
});
108+
109+
test("Table resizer is not loaded in readonly mode", async () => {
110+
createTable(model, "A1:B2");
111+
await nextTick();
112+
expect(".o-table-resizer").toHaveCount(1);
113+
model.updateMode("readonly");
114+
await nextTick();
115+
expect(".o-table-resizer").toHaveCount(0);
116+
});
108117
});

0 commit comments

Comments
 (0)