[MIG] web_search_with_and: Migration to 17.0

pull/3090/head
JasminSForgeFlow 2025-02-12 14:06:02 +05:30
parent e3278c73c1
commit d4f38cafc9
3 changed files with 14 additions and 4 deletions

View File

@ -4,7 +4,7 @@
{ {
"name": "Use AND conditions on omnibar search", "name": "Use AND conditions on omnibar search",
"version": "16.0.1.0.0", "version": "17.0.1.0.0",
"author": """Sandip SCS, Versada UAB, ACSONE SA/NV, Serincloud, "author": """Sandip SCS, Versada UAB, ACSONE SA/NV, Serincloud,
Odoo Community Association (OCA)""", Odoo Community Association (OCA)""",
"license": "AGPL-3", "license": "AGPL-3",

View File

@ -3,8 +3,17 @@
import {patch} from "@web/core/utils/patch"; import {patch} from "@web/core/utils/patch";
import {SearchBar} from "@web/search/search_bar/search_bar"; import {SearchBar} from "@web/search/search_bar/search_bar";
patch(SearchBar.prototype, "web_search_with_and/static/src/js/search_bar.js", { patch(SearchBar.prototype, {
selectItem(item) { selectItem(item) {
const searchItem = this.getSearchItem(item.searchItemId);
if (
(searchItem.type === "field" && searchItem.fieldType === "properties") ||
(searchItem.type === "field_property" && item.unselectable)
) {
this.toggleItem(item, !item.isExpanded);
return;
}
if (!item.unselectable) { if (!item.unselectable) {
const {searchItemId, label, operator, value} = item; const {searchItemId, label, operator, value} = item;
this.env.searchModel.addAutoCompletionValues(searchItemId, { this.env.searchModel.addAutoCompletionValues(searchItemId, {
@ -16,8 +25,9 @@ patch(SearchBar.prototype, "web_search_with_and/static/src/js/search_bar.js", {
} }
this.resetState(); this.resetState();
}, },
onSearchKeydown(ev) { onSearchKeydown(ev) {
this.isShiftKey = ev.shiftKey || false; this.isShiftKey = ev.shiftKey || false;
this._super(ev); super.onSearchKeydown(ev);
}, },
}); });

View File

@ -4,7 +4,7 @@ import {patch} from "@web/core/utils/patch";
import {rankInterval} from "@web/search/utils/dates"; import {rankInterval} from "@web/search/utils/dates";
import {SearchModel} from "@web/search/search_model"; import {SearchModel} from "@web/search/search_model";
patch(SearchModel.prototype, "web_search_with_and/static/src/js/search_model.js", { patch(SearchModel.prototype, {
_getGroups() { _getGroups() {
const preGroups = []; const preGroups = [];
for (const queryElem of this.query) { for (const queryElem of this.query) {