[FIX] web: search panel: fields should not be added in search bar
Let us consider the search arch
<search>
<field name="foo"/>
<searchpanel>
<field name="bar"/>
</searchpanel>
</search>
The two tags "field" are supposed to generate different objects:
- the first one should generate an entry in the search bar autocompletion
- the second one should generate a search panel section.
It turns out that the second field did also generate an entry in the
search bar. This is of course wrong. We fix that problem and add a test.
closes odoo/odoo#125724
X-original-commit: 7e62e3cf569e59a676a834198854f415fa0ae590
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
This commit is contained in:
@@ -69,8 +69,7 @@ export class SearchArchParser extends XMLParser {
|
||||
this.visitSearch(node, visitChildren);
|
||||
break;
|
||||
case "searchpanel":
|
||||
this.visitSearchPanel(node);
|
||||
break;
|
||||
return this.visitSearchPanel(node);
|
||||
case "group":
|
||||
this.visitGroup(node, visitChildren);
|
||||
break;
|
||||
|
||||
@@ -965,6 +965,25 @@ QUnit.module("Search", (hooks) => {
|
||||
assert.deepEqual(model.domain, [["date_deadline", "<", "2021-09-17"]]);
|
||||
});
|
||||
|
||||
QUnit.test("no search items created for search panel sections", async function (assert) {
|
||||
const model = await makeSearchModel({
|
||||
serverData,
|
||||
searchViewArch: `
|
||||
<search>
|
||||
<searchpanel>
|
||||
<field name="company_id"/>
|
||||
<field name="company_id" select="multi"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
`,
|
||||
resModel: "partner",
|
||||
config: { viewType: "kanban" },
|
||||
});
|
||||
const sections = model.getSections();
|
||||
assert.strictEqual(sections.length, 2);
|
||||
assert.deepEqual(sanitizeSearchItems(model), []);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"a field of type 'properties' should not be accepted as a search_default",
|
||||
async function (assert) {
|
||||
|
||||
Reference in New Issue
Block a user