diff --git a/addons/web/static/src/webclient/actions/action_service.js b/addons/web/static/src/webclient/actions/action_service.js index 31c3a57baab..1417e31d078 100644 --- a/addons/web/static/src/webclient/actions/action_service.js +++ b/addons/web/static/src/webclient/actions/action_service.js @@ -870,20 +870,8 @@ function makeActionManager(env) { if (url && !(url.startsWith("http") || url.startsWith("/"))) { url = "/" + url; } - if (action.target === "download") { + if (action.target === "download" || action.target === "self") { browser.location.assign(url); - } else if (action.target === "self") { - let willUnload = false; - const onUnload = () => { - willUnload = true; - }; - browser.addEventListener("beforeunload", onUnload); - env.services.ui.block(); - browser.location.assign(url); - browser.removeEventListener("beforeunload", onUnload); - if (!willUnload) { - env.services.ui.unblock(); - } } else { const w = browser.open(url, "_blank"); if (!w || w.closed || typeof w.closed === "undefined") { diff --git a/addons/web/static/tests/webclient/actions/url_action_tests.js b/addons/web/static/tests/webclient/actions/url_action_tests.js index e79149da88b..36b00cff26c 100644 --- a/addons/web/static/tests/webclient/actions/url_action_tests.js +++ b/addons/web/static/tests/webclient/actions/url_action_tests.js @@ -1,6 +1,5 @@ /** @odoo-module **/ -import { registry } from "@web/core/registry"; import { makeTestEnv } from "../../helpers/mock_env"; import { setupWebClientRegistries, doAction, getActionManagerServerData } from "./../helpers"; import { getFixture, patchWithCleanup } from "@web/../tests/helpers/utils"; @@ -8,7 +7,6 @@ import { browser } from "@web/core/browser/browser"; let target; let serverData; -const serviceRegistry = registry.category("services"); QUnit.module("ActionManager", (hooks) => { hooks.beforeEach(() => { @@ -34,28 +32,6 @@ QUnit.module("ActionManager", (hooks) => { assert.verifySteps(["/my/test/url"]); }); - QUnit.test("an 'ir.actions.act_url' with target 'self' blocks the ui", async (assert) => { - serviceRegistry.add("ui", { - start() { - return { - block: () => assert.step("block"), - // we can't simulate a page unload in the tests, so in this scenario the - // ui will be unblocked directly (and we thus need to define the unblock - // function) - unblock: () => {}, - }; - }, - }); - setupWebClientRegistries(); - const env = await makeTestEnv({ serverData }); - await doAction(env, { - type: "ir.actions.act_url", - target: "self", - url: "/my/test/url", - }); - assert.verifySteps(["block"]); - }); - QUnit.test("execute an 'ir.actions.act_url' action with onClose option", async (assert) => { setupWebClientRegistries(); patchWithCleanup(browser, {