diff --git a/addons/web/static/src/webclient/actions/action_service.js b/addons/web/static/src/webclient/actions/action_service.js index 45a92c92ae0..cb489325115 100644 --- a/addons/web/static/src/webclient/actions/action_service.js +++ b/addons/web/static/src/webclient/actions/action_service.js @@ -1081,11 +1081,15 @@ function makeActionManager(env) { let success, message; env.services.ui.block(); try { + const downloadContext = { ...env.services.user.context }; + if (action.context) { + Object.assign(downloadContext, action.context); + } ({ success, message } = await downloadReport( env.services.rpc, action, type, - env.services.user.context + downloadContext )); } finally { env.services.ui.unblock(); diff --git a/addons/web/static/tests/webclient/actions/reports/report_action_tests.js b/addons/web/static/tests/webclient/actions/reports/report_action_tests.js index 596e1837ebf..9112a253c1c 100644 --- a/addons/web/static/tests/webclient/actions/reports/report_action_tests.js +++ b/addons/web/static/tests/webclient/actions/reports/report_action_tests.js @@ -318,10 +318,14 @@ QUnit.module("ActionManager", (hooks) => { }); QUnit.test("context is correctly passed to the client action report", async (assert) => { - assert.expect(8); + assert.expect(9); mockDownload((options) => { assert.step(options.url); + assert.deepEqual( + options.data.context, + `{"lang":"en","uid":7,"tz":"taht","rabbia":"E Tarantella","active_ids":[99]}` + ); assert.deepEqual(JSON.parse(options.data.data), [ "/report/pdf/ennio.morricone/99", "qweb-pdf",