Skip to content
Snippets Groups Projects
Commit 0fde590b authored by Aaron Bohy's avatar Aaron Bohy
Browse files

[FIX] web: action service: sanitize action.domain


When it is unset, the domain of an action can be either false or
the empty string, which in both cases means []. Before this commit,
we didn't process the domain in thoses cases (i.e. we kept the
false or empty string value). However, having an empty string as
domain could cause issues if it is manipulated by Domain/pyutils.
In particular, in stock.picking, clicking on "Insert menu in
spreadsheet" crashed before this commit.

To prevent those issues from happening, this commit sanitizes the
domain of the action at the first entry point, such that it's
always an array (the empty array in our case).

This commit comes with a test in enterprise, which reproduces the
scenario given above, as we couldn't find framework and blackbox
scenario to highlight it.

closes odoo/odoo#135300

Related: odoo/enterprise#47350
Signed-off-by: default avatarSamuel Degueldre (sad) <sad@odoo.com>
parent ca23abf5
Branches
Tags
No related merge requests found
......@@ -185,16 +185,14 @@ function makeActionManager(env) {
function _preprocessAction(action, context = {}) {
action._originalAction = JSON.stringify(action);
action.context = makeContext([context, action.context], env.services.user.context);
if (action.domain) {
const domain = action.domain || [];
action.domain =
typeof domain === "string"
? evaluateExpr(
domain,
Object.assign({}, env.services.user.context, action.context)
)
: domain;
}
const domain = action.domain || [];
action.domain =
typeof domain === "string"
? evaluateExpr(
domain,
Object.assign({}, env.services.user.context, action.context)
)
: domain;
action = { ...action }; // manipulate a copy to keep cached action unmodified
action.jsId = `action_${++id}`;
if (action.type === "ir.actions.act_window" || action.type === "ir.actions.client") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment