[FIX] web: legacy action_menus: provide context to executeAction
In a list view in multicompany: - select all records with the main checkbox above the list - click on "Select All" to select every record for that domain - open the "Actions" dropdown and try to do an action Before this commit, there may be a fail on some records due to some records not belonging to the right company. This was because when fetching the active_ids from the server, the context, and hence the allowed companies, was not passed to the RPC. After this commit, the call to retrieve active_ids contains the allowed companies and the correct records are returned and treated. opw-2669292 closes odoo/odoo#79795 X-original-commit: 894430076423c81ec0804158249c354115030e9e Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Signed-off-by: Achraf <abz@odoo.com>
This commit is contained in:
committed by
Lucas Perais (lpe)
parent
93f17e9e3c
commit
951270d12f
@@ -120,6 +120,7 @@ odoo.define('web.ActionMenus', function (require) {
|
||||
args: [this.props.domain],
|
||||
kwargs: {
|
||||
limit: this.env.session.active_ids_limit,
|
||||
context: this.props.context,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -246,5 +246,33 @@ odoo.define('web.action_menus_tests', function (require) {
|
||||
|
||||
actionMenus.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('execute action with context', async function (assert) {
|
||||
assert.expect(1);
|
||||
const actionMenus = await createComponent(ActionMenus, {
|
||||
env: {
|
||||
action: this.action,
|
||||
view: this.view,
|
||||
},
|
||||
props: {
|
||||
...this.props,
|
||||
isDomainSelected: true,
|
||||
context: {
|
||||
allowed_company_ids: [112],
|
||||
},
|
||||
},
|
||||
async mockRPC(route, args) {
|
||||
if (route === "/web/dataset/call_kw/hobbit/search"){
|
||||
assert.deepEqual(args.kwargs.context, { allowed_company_ids: [112] }, "The kwargs should contains the right context");
|
||||
}
|
||||
return this._super(...arguments);
|
||||
},
|
||||
});
|
||||
|
||||
await testUtils.controlPanel.toggleActionMenu(actionMenus, "Action");
|
||||
await testUtils.controlPanel.toggleMenuItem(actionMenus, "What's taters, precious ?");
|
||||
|
||||
actionMenus.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user