3
0
Fork 0

[FIX] web_advanced_search: display label name in partners search

Without this patch, when searching in the `res.partner` view for 'Tags is equal to "Something"', the search bar would display "Tags is equal to "123"' (the tag ID instead of its display name).

@moduon MT-7870
16.0
Jairo Llopis 2024-11-08 10:53:01 +00:00
parent 7c2a4eaef6
commit 04c99b9044
No known key found for this signature in database
GPG Key ID: B24A1D10508180D8
1 changed files with 4 additions and 2 deletions

View File

@ -15,19 +15,21 @@ patch(CustomFilterItem.prototype, "web_advanced_search.CustomFilterItem", {
this._super.apply(this, arguments);
this.OPERATORS.relational = this.OPERATORS.char;
this.FIELD_TYPES.many2one = "relational";
this.FIELD_TYPES.many2many = "relational";
this.FIELD_TYPES.one2many = "relational";
},
/**
* @override
*/
setDefaultValue(condition) {
const res = this._super.apply(this, arguments);
const fieldType = this.fields[condition.field].type;
const genericType = this.FIELD_TYPES[fieldType];
if (genericType === "relational") {
condition.value = 0;
condition.displayedValue = "";
return;
}
return res;
return this._super.apply(this, arguments);
},
/**
* Add displayed value to preFilters for "relational" types.