Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
import {patch} from "@web/core/utils/patch";
import {SearchBar} from "@web/search/search_bar/search_bar";
patch(SearchBar.prototype, {
selectItem(item) {
if (item.isAddCustomFilterButton) {
return this.env.searchModel.spawnCustomFilterDialog();
}
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) {
const {searchItemId, label, operator, value} = item;
const autoCompleteValues = {
label,
operator,
value,
isShiftKey: this.isShiftKey,
};
if (value && value[0] === '"' && value[value.length - 1] === '"') {
autoCompleteValues.value = value.slice(1, -1);
autoCompleteValues.label = label.slice(1, -1);
autoCompleteValues.operator = "=";
autoCompleteValues.enforceEqual = true;
}
this.env.searchModel.addAutoCompletionValues(
searchItemId,
autoCompleteValues
);
}
if (item.loadMore) {
item.loadMore();
} else {
this.resetState();
}
},
onSearchKeydown(ev) {
this.isShiftKey = ev.shiftKey || false;
super.onSearchKeydown(ev);
},
});

View File

@@ -0,0 +1,82 @@
import {patch} from "@web/core/utils/patch";
import {rankInterval} from "@web/search/utils/dates";
import {SearchModel} from "@web/search/search_model";
patch(SearchModel.prototype, {
_getGroups() {
const preGroups = [];
for (const queryElem of this.query) {
const {searchItemId} = queryElem;
let {groupId} = this.searchItems[searchItemId];
if ("autocompleteValue" in queryElem) {
if (queryElem.autocompleteValue.isShiftKey) {
groupId = Math.random();
}
}
let preGroup = preGroups.find((group) => group.id === groupId);
if (!preGroup) {
preGroup = {id: groupId, queryElements: []};
preGroups.push(preGroup);
}
queryElem.groupId = groupId;
preGroup.queryElements.push(queryElem);
}
const groups = [];
for (const preGroup of preGroups) {
const {queryElements, id} = preGroup;
const activeItems = [];
for (const queryElem of queryElements) {
const {searchItemId} = queryElem;
let activeItem = activeItems.find(
({searchItemId: id}) => id === searchItemId
);
if ("generatorId" in queryElem) {
if (!activeItem) {
activeItem = {searchItemId, generatorIds: []};
activeItems.push(activeItem);
}
activeItem.generatorIds.push(queryElem.generatorId);
} else if ("intervalId" in queryElem) {
if (!activeItem) {
activeItem = {searchItemId, intervalIds: []};
activeItems.push(activeItem);
}
activeItem.intervalIds.push(queryElem.intervalId);
} else if ("autocompleteValue" in queryElem) {
if (!activeItem) {
activeItem = {searchItemId, autocompletValues: []};
activeItems.push(activeItem);
}
activeItem.autocompletValues.push(queryElem.autocompleteValue);
} else if (!activeItem) {
activeItem = {searchItemId};
activeItems.push(activeItem);
}
}
for (const activeItem of activeItems) {
if ("intervalIds" in activeItem) {
activeItem.intervalIds.sort(
(g1, g2) => rankInterval(g1) - rankInterval(g2)
);
}
}
groups.push({id, activeItems});
}
return groups;
},
deactivateGroup(groupId) {
this.query = this.query.filter((queryElem) => {
return queryElem.groupId !== groupId;
});
for (const partName in this.domainParts) {
const part = this.domainParts[partName];
if (part.groupId === groupId) {
this.setDomainParts({[partName]: null});
}
}
this._checkComparisonStatus();
this._notify();
},
});