diff --git a/addons/web/static/src/webclient/actions/action_service.js b/addons/web/static/src/webclient/actions/action_service.js index dee040e4191..d8c3b859d96 100644 --- a/addons/web/static/src/webclient/actions/action_service.js +++ b/addons/web/static/src/webclient/actions/action_service.js @@ -312,6 +312,9 @@ function makeActionManager(env) { // the session storage const storedAction = browser.sessionStorage.getItem("current_action"); const lastAction = JSON.parse(storedAction || "{}"); + if (lastAction.help) { + lastAction.help = markup(lastAction.help); + } if (lastAction.res_model === state.model) { if (lastAction.context) { // If this method is called because of a company switch, the diff --git a/addons/web/static/tests/webclient/actions/load_state_tests.js b/addons/web/static/tests/webclient/actions/load_state_tests.js index 75d0ed01d73..0074e9792bf 100644 --- a/addons/web/static/tests/webclient/actions/load_state_tests.js +++ b/addons/web/static/tests/webclient/actions/load_state_tests.js @@ -1069,4 +1069,45 @@ QUnit.module("ActionManager", (hooks) => { menu_id: 1, }); }); + + QUnit.test( + "'no content helper' is markuped when action is retrieved from session storage", + async function (assert) { + // for the no content helper to show, we empty the data + serverData.models.partner.records = []; + serverData.actions[4].help = "

Some nice help

"; + + patchWithCleanup(browser.sessionStorage, { + getItem(k) { + assert.step(`getItem session ${k}`); + return this._super(k); + }, + }); + + const webClient = await createWebClient({ serverData }); + + await doAction(webClient, 4); + assert.containsOnce(target, ".o_kanban_view", "should display a kanban view"); + + assert.strictEqual( + "Some nice help", + target.querySelector(".o_nocontent_help").innerText + ); + + await loadState(webClient, { + model: "partner", + view_type: "list", + }); + + assert.containsNone(target, ".o_kanban_view", "should no longer display a kanban view"); + assert.containsOnce(target, ".o_list_view", "should display a list view"); + + assert.strictEqual( + "Some nice help", + target.querySelector(".o_nocontent_help").innerText + ); + + assert.verifySteps(["getItem session current_action"]); + } + ); });