diff --git a/addons/web/static/src/legacy/action_adapters.js b/addons/web/static/src/legacy/action_adapters.js
index 1fdd239e091..2f48aa6d010 100644
--- a/addons/web/static/src/legacy/action_adapters.js
+++ b/addons/web/static/src/legacy/action_adapters.js
@@ -381,7 +381,11 @@ export class ViewAdapter extends ActionAdapter {
if (ev.name === "switch_view") {
if (payload.view_type === "form") {
if (payload.res_id) {
- return this.props.selectRecord(payload.res_id, { mode: payload.mode });
+ const activeIds = this.__widget.model.get(this.__widget.handle).res_ids;
+ return this.props.selectRecord(payload.res_id, {
+ mode: payload.mode,
+ activeIds,
+ });
} else {
return this.props.createRecord();
}
diff --git a/addons/web/static/tests/webclient/actions/legacy_tests.js b/addons/web/static/tests/webclient/actions/legacy_tests.js
index 5485823dc4a..1e766fd19dd 100644
--- a/addons/web/static/tests/webclient/actions/legacy_tests.js
+++ b/addons/web/static/tests/webclient/actions/legacy_tests.js
@@ -24,6 +24,7 @@ import { ClientActionAdapter, ViewAdapter } from "@web/legacy/action_adapters";
import { makeLegacyCrashManagerService } from "@web/legacy/utils";
import { useDebugCategory } from "@web/core/debug/debug_context";
import { ErrorDialog } from "@web/core/errors/error_dialogs";
+import * as cpHelpers from "@web/../tests/search/helpers";
import AbstractView from "web.AbstractView";
import ControlPanel from "web.ControlPanel";
@@ -742,4 +743,34 @@ QUnit.module("ActionManager", (hooks) => {
await legacyExtraNextTick();
assert.containsOnce(target, ".o_legacy_form_view");
});
+
+ QUnit.test("correct pager when coming from list (legacy)", async (assert) => {
+ assert.expect(4);
+
+ registry.category("views").remove("list");
+ legacyViewRegistry.add("list", ListView);
+ serverData.views = {
+ "partner,false,search": `
`,
+ "partner,100,form": `