[FIX] spreadsheet_account: prevent key-error when click on 'See records'

This issue is caught by a sentry. When the user clicks on 'See Records' from the
spreadsheet user gets key-error 'codes'! When clicking on 'See Records' it tries
to get the domain and the domain takes 'codes'
in this function:- spreadsheet_move_line_action()

In this PR(https://github.com/odoo/odoo/pull/113359) they changed the key from
'code' to 'codes'.

sentry - 3961028578

closes odoo/odoo#114161

X-original-commit: 83a8d5437da5da3d5ff5e6395952214e8d08e8f4
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
This commit is contained in:
uso-odoo
2023-03-06 13:13:11 +01:00
committed by Lucas Lefèvre
parent 263066cbef
commit 30310e7ae7
2 changed files with 4 additions and 4 deletions
@@ -20,10 +20,10 @@ cellMenuRegistry.add("move_lines_see_records", {
const position = env.model.getters.getActivePosition();
const cell = env.model.getters.getCell(position);
const { args } = getFirstAccountFunction(cell.content);
let [code, date_range, offset, companyId, includeUnposted] = args
let [codes, date_range, offset, companyId, includeUnposted] = args
.map(astToFormula)
.map((arg) => env.model.getters.evaluateFormula(arg));
code = toString(code);
codes = toString(codes).split(",");
const dateRange = parseAccountingDate(date_range);
dateRange.year += offset || 0;
companyId = companyId || null;
@@ -32,7 +32,7 @@ cellMenuRegistry.add("move_lines_see_records", {
const action = await env.services.orm.call(
"account.account",
"spreadsheet_move_line_action",
[camelToSnakeObject({ dateRange, companyId, code, includeUnposted })]
[camelToSnakeObject({ dateRange, companyId, codes, includeUnposted })]
);
await env.services.action.doAction(action);
},
@@ -49,7 +49,7 @@ QUnit.module("spreadsheet_account > Accounting Drill down", { beforeEach }, () =
if (args.method === "spreadsheet_move_line_action") {
assert.deepEqual(args.args, [
{
code: "100",
codes: ["100"],
company_id: null,
include_unposted: false,
date_range: {