diff --git a/addons/web/static/src/legacy/js/components/action_menus.js b/addons/web/static/src/legacy/js/components/action_menus.js index ed95e6663fa..06bf3be3207 100644 --- a/addons/web/static/src/legacy/js/components/action_menus.js +++ b/addons/web/static/src/legacy/js/components/action_menus.js @@ -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, }, }); } diff --git a/addons/web/static/tests/legacy/components/action_menus_tests.js b/addons/web/static/tests/legacy/components/action_menus_tests.js index ab2aac9be9c..8cbf6ff738d 100644 --- a/addons/web/static/tests/legacy/components/action_menus_tests.js +++ b/addons/web/static/tests/legacy/components/action_menus_tests.js @@ -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(); + }); }); });