From 155ec0366db91184dda587922b97972e5f904391 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Wed, 6 Apr 2022 08:29:38 +0000 Subject: [PATCH] [FIX] web: error when closing action Dialog Before this commit, when closing an action Dialog ( when the action is wowl ) an error was raised. This occurs because we use the LegacyAdaptedActionDialog, and an old function is called. closes odoo/odoo#88118 X-original-commit: a6e45c53642003243e8a0f498e69ffddcac6e086 Signed-off-by: Lucas Perais (lpe) --- .../src/webclient/actions/action_dialog.xml | 2 +- .../webclient/actions/client_action_tests.js | 27 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/webclient/actions/action_dialog.xml b/addons/web/static/src/webclient/actions/action_dialog.xml index 9af80efc355..360017a2ecf 100644 --- a/addons/web/static/src/webclient/actions/action_dialog.xml +++ b/addons/web/static/src/webclient/actions/action_dialog.xml @@ -19,7 +19,7 @@ - diff --git a/addons/web/static/tests/webclient/actions/client_action_tests.js b/addons/web/static/tests/webclient/actions/client_action_tests.js index cf2abfb8583..80bd598e97f 100644 --- a/addons/web/static/tests/webclient/actions/client_action_tests.js +++ b/addons/web/static/tests/webclient/actions/client_action_tests.js @@ -6,7 +6,13 @@ import core from "web.core"; import AbstractAction from "web.AbstractAction"; import testUtils from "web.test_utils"; import { registerCleanup } from "../../helpers/cleanup"; -import { click, getFixture, legacyExtraNextTick, patchWithCleanup } from "../../helpers/utils"; +import { + click, + getFixture, + legacyExtraNextTick, + nextTick, + patchWithCleanup, +} from "../../helpers/utils"; import { createWebClient, doAction, getActionManagerServerData } from "./../helpers"; const { Component, xml } = owl; @@ -36,6 +42,25 @@ QUnit.module("ActionManager", (hooks) => { assert.strictEqual(target.querySelector(".modal-title").textContent, "Dialog Test"); }); + QUnit.test( + "can display client actions in Dialog and close the dialog", + async function (assert) { + assert.expect(3); + const webClient = await createWebClient({ serverData }); + await doAction(webClient, { + name: "Dialog Test", + target: "new", + tag: "__test__client__action__", + type: "ir.actions.client", + }); + assert.containsOnce(target, ".modal .test_client_action"); + assert.strictEqual(target.querySelector(".modal-title").textContent, "Dialog Test"); + target.querySelector(".modal footer .btn.btn-primary").click(); + await nextTick(); + assert.containsNone(target, ".modal .test_client_action"); + } + ); + QUnit.test("can display client actions as main, then in Dialog", async function (assert) { assert.expect(3); const webClient = await createWebClient({ serverData });