[FIX] spreadsheet_account: Prevent cell menu crash on non-fomula cell

The adaptation made in commit 037e5b8, related to this [commit](https://github.com/odoo/o-spreadsheet/commit/17ba12211) forgot to account for non-fomula cells.

closes odoo/odoo#148510

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
This commit is contained in:
Rémi Rahir (rar)
2024-01-10 06:12:25 +00:00
parent 09e1040cd1
commit c14813c17f
2 changed files with 5 additions and 0 deletions
@@ -46,6 +46,7 @@ cellMenuRegistry.add("move_lines_see_records", {
!evaluatedCell.error &&
evaluatedCell.value !== "" &&
cell &&
cell.isFormula &&
getNumberOfAccountFormulas(cell.compiledFormula.tokens) === 1
);
},
@@ -66,6 +66,8 @@ QUnit.module("spreadsheet_account > Accounting Drill down", { beforeEach }, () =
env.model = model;
setCellContent(model, "A1", `=ODOO.BALANCE("100", 2020)`);
setCellContent(model, "A2", `=ODOO.BALANCE("100", 0)`);
// Does not affect non formula cells
setCellContent(model, "A4", `5`);
await waitForDataSourcesLoaded(model);
selectCell(model, "A1");
const root = cellMenuRegistry
@@ -76,5 +78,7 @@ QUnit.module("spreadsheet_account > Accounting Drill down", { beforeEach }, () =
assert.verifySteps(["drill down action"]);
selectCell(model, "A2");
assert.equal(root.isVisible(env), false);
selectCell(model, "A4");
assert.equal(root.isVisible(env), false);
});
});