Skip to content
Snippets Groups Projects
Commit 93a8dd62 authored by Mathieu Duckerts-Antoine's avatar Mathieu Duckerts-Antoine
Browse files

[FIX] web: custom filter: description of selection field values


When creating a custom filter based on a selection field, the description
obtained in the resulting facet would use the value instead of the usual
string representation of that value. For example, in CRM > Lead, create
a custom filter based on the field "priority" like "[("priority", "=", 0)]"
would result in a Facet "Priority is '0'" instead of "Priority is 'Low'".

closes odoo/odoo#119628

Signed-off-by: default avatarMichaël Mattiello <mcm@odoo.com>
parent 53a10617
Branches
Tags
No related merge requests found
......@@ -234,7 +234,13 @@ export class CustomFilterItem extends Component {
);
} else {
domainValue = [condition.value];
descriptionArray.push(`"${condition.value}"`);
if (field.type === "selection") {
descriptionArray.push(
`"${field.selection.find((v) => v[0] === condition.value)[1]}"`
);
} else {
descriptionArray.push(`"${condition.value}"`);
}
}
// Operator specifics
if (operator.symbol === "between") {
......
......@@ -406,7 +406,7 @@ QUnit.module("Search", (hooks) => {
await editConditionField(target, 0, "color");
await applyFilter(target);
assert.deepEqual(getFacetTexts(target), ['Color is "black"']);
assert.deepEqual(getFacetTexts(target), ['Color is "Black"']);
assert.deepEqual(getDomain(controlPanel), [["color", "=", "black"]]);
assert.containsN(target, ".o_menu_item", 1);
......@@ -427,7 +427,7 @@ QUnit.module("Search", (hooks) => {
);
await applyFilter(target);
assert.deepEqual(getFacetTexts(target), ['Color is "white"']);
assert.deepEqual(getFacetTexts(target), ['Color is "White"']);
assert.deepEqual(getDomain(controlPanel), [["color", "=", "white"]]);
assert.containsN(target, ".o_menu_item", 2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment