[FIX] web: actions in target="new" should not update title
Before this commit, all actions, even those executed in target "new" (i.e. in dialogs) updated the document's title. Actions in dialog should not do that. closes odoo/odoo#72526 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
@@ -29,13 +29,13 @@ class ActionAdapter extends ComponentAdapter {
|
||||
let originalUpdateControlPanel;
|
||||
useEffect(
|
||||
() => {
|
||||
this.title.setParts({ action: this.widget.getTitle() });
|
||||
const query = this.widget.getState();
|
||||
Object.assign(query, this.tempQuery);
|
||||
this.tempQuery = null;
|
||||
this.__widget = this.widget;
|
||||
if (!this.wowlEnv.inDialog) {
|
||||
this.pushState(query);
|
||||
this.title.setParts({ action: this.widget.getTitle() });
|
||||
}
|
||||
this.wowlEnv.bus.on("ACTION_MANAGER:UPDATE", this, () => {
|
||||
this.env.bus.trigger("close_dialogs");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import testUtils from "web.test_utils";
|
||||
import core from "web.core";
|
||||
import AbstractAction from "web.AbstractAction";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { legacyExtraNextTick } from "../../helpers/utils";
|
||||
import { createWebClient, doAction, getActionManagerServerData } from "./../helpers";
|
||||
|
||||
@@ -297,6 +298,30 @@ QUnit.module("ActionManager", (hooks) => {
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('actions in target="new" do not update page title', async function (assert) {
|
||||
const mockedTitleService = {
|
||||
start() {
|
||||
return {
|
||||
setParts({ action }) {
|
||||
if (action) {
|
||||
assert.step(action);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
registry.category("services").add("title", mockedTitleService);
|
||||
const webClient = await createWebClient({ serverData });
|
||||
|
||||
// sanity check: execute an action in target="current"
|
||||
await doAction(webClient, 1);
|
||||
assert.verifySteps(["Partners Action 1"]);
|
||||
|
||||
// execute an action in target="new"
|
||||
await doAction(webClient, 5);
|
||||
assert.verifySteps([]);
|
||||
});
|
||||
|
||||
QUnit.module('Actions in target="inline"');
|
||||
QUnit.test(
|
||||
'form views for actions in target="inline" open in edit mode',
|
||||
|
||||
Reference in New Issue
Block a user