[FIX] web: Breadcrumb to FormView
Before this commit, going to a form view using the breadcrumb menu did not retrieve the record id. The record id was not present in the url. So, if you reloaded the page, the record was not displayed anymore. closes odoo/odoo#80174 X-original-commit: 3eeaa6b1c6f54be9a87e67140ab57fe8f3a61407 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
@@ -1336,7 +1336,7 @@ function makeActionManager(env) {
|
||||
const props = controller.props;
|
||||
newState.model = props.resModel;
|
||||
newState.view_type = props.type;
|
||||
newState.id = props.resId || undefined;
|
||||
newState.id = props.resId || (props.state && props.state.currentId) || undefined;
|
||||
}
|
||||
env.services.router.pushState(newState, { replace: true });
|
||||
}
|
||||
|
||||
@@ -1329,6 +1329,26 @@ QUnit.module("ActionManager", (hooks) => {
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"form views are restored with the correct id in its url when coming back in breadcrumbs",
|
||||
async function (assert) {
|
||||
assert.expect(3);
|
||||
const webClient = await createWebClient({ serverData });
|
||||
await doAction(webClient, 3);
|
||||
// open a record in form view
|
||||
await testUtils.dom.click($(webClient.el).find(".o_list_view .o_data_row:first"));
|
||||
await legacyExtraNextTick();
|
||||
assert.strictEqual(webClient.env.services.router.current.hash.id, 1);
|
||||
// do some other action
|
||||
await doAction(webClient, 4);
|
||||
assert.notOk(webClient.env.services.router.current.hash.id);
|
||||
// go back to form view
|
||||
await testUtils.dom.clickLast($(webClient.el).find(".o_control_panel .breadcrumb a"));
|
||||
await legacyExtraNextTick();
|
||||
assert.strictEqual(webClient.env.services.router.current.hash.id, 1);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("honor group_by specified in actions context", async function (assert) {
|
||||
assert.expect(5);
|
||||
serverData.actions[3].context = "{'group_by': 'bar'}";
|
||||
|
||||
Reference in New Issue
Block a user