[FIX] web: duplicated breadcrumbs when discarding settings
Steps to reproduce: - Go to settings - Click on discard -> the breadcrumbs contains twice the "Settings" entry. This commit fixes the issue by restoring the legacy behavior in the "Discard" button handler, that is, calling doActionButton with the special="cancel" param. This had been changed by mistake during the conversion of the settings form view. To make the fix work, a slight changed has been done in the model as well, as reloading a datapoint could lead to the creation of a new datapoint (typically when it's a new record), so the handle must be updated in this case. closes odoo/odoo#99904 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
committed by
Aaron Bohy
parent
a3eec47f35
commit
04b3a890d4
@@ -503,7 +503,7 @@ export class Record extends DataPoint {
|
||||
viewType: this.__viewType,
|
||||
});
|
||||
} else {
|
||||
await this.model.__bm__.reload(this.__bm_handle__, {
|
||||
this.__bm_handle__ = await this.model.__bm__.reload(this.__bm_handle__, {
|
||||
viewType: this.__viewType,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ export class SettingsFormController extends formView.Controller {
|
||||
clickParams: {
|
||||
name: "cancel",
|
||||
type: "object",
|
||||
special: "cancel",
|
||||
},
|
||||
getResParams: () =>
|
||||
pick(this.model.root, "context", "evalContext", "resModel", "resId", "resIds"),
|
||||
|
||||
@@ -685,7 +685,7 @@ QUnit.module("SettingsFormView", (hooks) => {
|
||||
QUnit.test(
|
||||
"clicking on any button in setting should show discard warning if setting form is dirty",
|
||||
async function (assert) {
|
||||
assert.expect(12);
|
||||
assert.expect(11);
|
||||
|
||||
serverData.actions = {
|
||||
1: {
|
||||
@@ -735,10 +735,6 @@ QUnit.module("SettingsFormView", (hooks) => {
|
||||
assert.ok("execute method called");
|
||||
return true;
|
||||
}
|
||||
if (args.method === "cancel") {
|
||||
assert.ok("cancel method called");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1253,7 +1249,7 @@ QUnit.module("SettingsFormView", (hooks) => {
|
||||
}
|
||||
);
|
||||
QUnit.test("Discard button clean the settings view", async function (assert) {
|
||||
assert.expect(5);
|
||||
assert.expect(10);
|
||||
|
||||
serverData.actions = {
|
||||
1: {
|
||||
@@ -1291,21 +1287,18 @@ QUnit.module("SettingsFormView", (hooks) => {
|
||||
};
|
||||
|
||||
const mockRPC = (route, args) => {
|
||||
if (route === "/web/dataset/call_button" && args.method === "cancel") {
|
||||
assert.step("cancel");
|
||||
return Promise.resolve({
|
||||
name: "Settings view",
|
||||
res_model: "res.config.settings",
|
||||
type: "ir.actions.act_window",
|
||||
target: "inline",
|
||||
views: [[false, "form"]],
|
||||
});
|
||||
}
|
||||
assert.step(args.method || route);
|
||||
};
|
||||
|
||||
const webClient = await createWebClient({ serverData, mockRPC });
|
||||
|
||||
await doAction(webClient, 1);
|
||||
assert.verifySteps([
|
||||
"/web/webclient/load_menus",
|
||||
"/web/action/load",
|
||||
"get_views",
|
||||
"onchange",
|
||||
]);
|
||||
assert.containsNone(
|
||||
target,
|
||||
".o_field_boolean input:checked",
|
||||
@@ -1322,8 +1315,7 @@ QUnit.module("SettingsFormView", (hooks) => {
|
||||
".o_field_boolean input:checked",
|
||||
"checkbox should not be checked"
|
||||
);
|
||||
|
||||
assert.verifySteps(["cancel"]);
|
||||
assert.verifySteps(["onchange"]);
|
||||
});
|
||||
|
||||
QUnit.test("Settings Radio widget: show and search", async function (assert) {
|
||||
|
||||
Reference in New Issue
Block a user