From 4b078525b5d5e894f3b47e0562f978aa863cb55e Mon Sep 17 00:00:00 2001 From: Mathieu Duckerts-Antoine Date: Tue, 28 Mar 2023 12:50:46 +0000 Subject: [PATCH] [REF] web: search: remove support of domain parts Since the dashboard view has been removed, there was no more true usage of setDomainParts. We thus remove the support of domain parts. Part-of: odoo/odoo#118057 --- addons/web/static/src/search/search_model.js | 51 -------------------- 1 file changed, 51 deletions(-) diff --git a/addons/web/static/src/search/search_model.js b/addons/web/static/src/search/search_model.js index 83ebdc51d34..9034dd02776 100644 --- a/addons/web/static/src/search/search_model.js +++ b/addons/web/static/src/search/search_model.js @@ -260,7 +260,6 @@ export class SearchModel extends EventBus { if (config.state) { this._importState(config.state); this.__legacyParseSearchPanelArchAnyway(searchViewDescription, searchViewFields); - this.domainParts = {}; this.display = this._getDisplay(config.display); if (!this.searchPanelInfo.loaded) { return this._reloadSections(); @@ -277,9 +276,6 @@ export class SearchModel extends EventBus { this.nextGroupId = 1; this.nextGroupNumber = 1; - // ... to rework (API for external domain, groupBy, facet) - this.domainParts = {}; // put in state? - const searchDefaults = {}; const searchPanelDefaults = {}; @@ -636,13 +632,6 @@ export class SearchModel extends EventBus { const searchItem = this.searchItems[queryElem.searchItemId]; return searchItem.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(); } @@ -677,19 +666,6 @@ export class SearchModel extends EventBus { return state; } - getDomainPart(partName) { - const part = this.domainParts[partName] || null; - if (part) { - return deepCopy(part); - } - return part; - } - - getDomainParts() { - const copy = deepCopy(this.domainParts); - return sortBy(Object.values(copy), (part) => part.groupId); - } - getFullComparison() { let searchItem = null; for (const queryElem of this.query.slice().reverse()) { @@ -797,20 +773,6 @@ export class SearchModel extends EventBus { this.trigger("update"); } - setDomainParts(parts) { - for (const key in parts) { - const val = parts[key]; - - if (!val) { - delete this.domainParts[key]; - } else { - this.domainParts[key] = val; - val.groupId = this.nextGroupId++; - } - } - this._notify(); - } - /** * Set the active value id of a given category. * @param {number} sectionId @@ -1523,9 +1485,6 @@ export class SearchModel extends EventBus { domains.push(groupDomain); } - for (const { domain } of this.getDomainParts()) { - domains.push(domain); - } // we need to manage (optional) facets, deactivateGroup, clearQuery,... if (this.display.searchPanel && withSearchPanel) { @@ -1609,16 +1568,6 @@ export class SearchModel extends EventBus { facets.push(facet); } - for (const { facetLabel, groupId } of this.getDomainParts()) { - const type = "filter"; - facets.push({ - groupId, - type, - values: [facetLabel], - icon: FACET_ICONS[type], - }); - } - return facets; }