[FIX] web: load search panel after switching view type
Steps to follow - Go to the Rental app - Switch to the pivot view - Refresh the page - Switch to the list view -> The search panel has not been correctly loaded Solution Check if the section values contain any value other than the default one. If not, they need to be loaded. opw-2710619 closes odoo/odoo#85866 X-original-commit: f61816acac04b76b734286165dcb660f9afb5a8b Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com> Signed-off-by: Samuel Degueldre <sad@odoo.com>
This commit is contained in:
@@ -157,12 +157,15 @@
|
||||
* @override
|
||||
*/
|
||||
importState(importedState) {
|
||||
this.initialStateImport = Boolean(importedState && !this.state.sections);
|
||||
this.initialStateImport = false;
|
||||
super.importState(...arguments);
|
||||
if (importedState) {
|
||||
this.state.sections = new Map(this.state.sections);
|
||||
for (const section of this.state.sections.values()) {
|
||||
section.values = new Map(section.values);
|
||||
if ([...section.values.keys()].some(e => e !== false)) {
|
||||
this.initialStateImport = true;
|
||||
}
|
||||
if (section.groups) {
|
||||
section.groups = new Map(section.groups);
|
||||
for (const group of section.groups.values()) {
|
||||
|
||||
@@ -2237,6 +2237,40 @@ QUnit.module("Search", (hooks) => {
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"categories and filters are loaded when switching from a view without the search panel",
|
||||
async (assert) => {
|
||||
assert.expect(5);
|
||||
|
||||
// set the pivot view as the default view
|
||||
serverData.actions[1].views = [
|
||||
[false, "pivot"],
|
||||
[false, "kanban"],
|
||||
[false, "list"],
|
||||
];
|
||||
|
||||
const webclient = await createWebClient({
|
||||
serverData,
|
||||
async mockRPC(route, {method}) {
|
||||
if (/search_panel_/.test(method || route)) {
|
||||
assert.step(method || route);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
await doAction(webclient, 1);
|
||||
assert.verifySteps([]);
|
||||
|
||||
await switchView(target, "list");
|
||||
await legacyExtraNextTick();
|
||||
assert.verifySteps(["search_panel_select_range", "search_panel_select_multi_range"]);
|
||||
|
||||
await switchView(target, "kanban");
|
||||
await legacyExtraNextTick();
|
||||
assert.verifySteps([]);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("scroll position is kept when switching between controllers", async (assert) => {
|
||||
assert.expect(6);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user