From 0ae13be7debb191585a339bb6d8868bd6acf25b5 Mon Sep 17 00:00:00 2001 From: Mathieu Duckerts-Antoine Date: Fri, 18 Feb 2022 09:37:42 +0000 Subject: [PATCH] [FIX] web: action service: button action with html help The method call_button sometimes returns an action with a help key. That help was not marked up, leading to an incorrect display of that help. closes odoo/odoo#84869 Signed-off-by: Aaron Bohy (aab) --- .../src/webclient/actions/action_service.js | 3 ++ .../webclient/actions/window_action_tests.js | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/addons/web/static/src/webclient/actions/action_service.js b/addons/web/static/src/webclient/actions/action_service.js index b408c8522cd..0a983c087f0 100644 --- a/addons/web/static/src/webclient/actions/action_service.js +++ b/addons/web/static/src/webclient/actions/action_service.js @@ -1184,6 +1184,9 @@ function makeActionManager(env) { action && typeof action === "object" ? action : { type: "ir.actions.act_window_close" }; + if (action.help) { + action.help = markup(action.help); + } } else if (params.type === "action") { // execute a given action, so load it first context.active_id = params.resId || null; diff --git a/addons/web/static/tests/webclient/actions/window_action_tests.js b/addons/web/static/tests/webclient/actions/window_action_tests.js index f6b2539c057..eeeabc0248b 100644 --- a/addons/web/static/tests/webclient/actions/window_action_tests.js +++ b/addons/web/static/tests/webclient/actions/window_action_tests.js @@ -983,6 +983,34 @@ QUnit.module("ActionManager", (hooks) => { } ); + QUnit.test("action with html help returned by a call_button", async function (assert) { + assert.expect(1); + const mockRPC = async (route, args) => { + if (route === "/web/dataset/call_button") { + return Promise.resolve({ + res_model: "partner", + type: "ir.actions.act_window", + views: [[false, "list"]], + help: "

I am not a helper

", + domain: [[0, "=", 1]], + }); + } + }; + const webClient = await createWebClient({ serverData, mockRPC }); + await doAction(webClient, 3); + + // open a record in form view + await click(target.querySelector(".o_list_view .o_data_row")); + await legacyExtraNextTick(); + + await click(target.querySelector(".o_statusbar_buttons button")); + await legacyExtraNextTick(); + assert.strictEqual( + target.querySelector(".o_list_view .o_nocontent_help p").innerText, + "I am not a helper" + ); + }); + QUnit.test("can open different records from a multi record view", async function (assert) { assert.expect(12); const mockRPC = async (route, args) => {