[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) <lpe@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2022-04-07 13:23:59 +02:00
parent 4853444dca
commit 155ec0366d
2 changed files with 27 additions and 2 deletions
@@ -19,7 +19,7 @@
<t t-name="web.LegacyAdaptedActionDialogFooter" owl="1">
<t t-if="!isLegacy">
<t t-slot="buttons">
<button class="btn btn-primary" t-on-click="_close">
<button class="btn btn-primary" t-on-click="close">
<t>Ok</t>
</button>
</t>
@@ -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 });