Skip to content

Commit

Permalink
[14.0][FIX] Modified search facet for field type
Browse files Browse the repository at this point in the history
  • Loading branch information
anusriNPS committed Oct 21, 2024
1 parent 76fb5aa commit 49e0014
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
15 changes: 14 additions & 1 deletion web_edit_user_filter/static/src/js/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ odoo.define("web_edit_user_filter/static/src/js/backend.js", function (require)
});
}
}
if (facet_type == "field" && selectedFacet.length) {
for (let i = 0; i < selectedFacet.length; i++) {
for (const [key, value] of Object.entries(selectedFacet[i])) {
if (key === "autoCompleteValues") {
const new_description = [];
for (const [, desc] of Object.entries(value)) {
new_description.push(desc.label);
}
selectedFacet[i].description = new_description;
}
}
}
}
var $facet = $($el);
var $content = $(
qweb.render("web_edit_user_filter.Popover", {
Expand Down Expand Up @@ -174,7 +187,7 @@ odoo.define("web_edit_user_filter/static/src/js/backend.js", function (require)
} else {
self.model.dispatch("toggleFilter", facetIdEl);
}
} else if (type === "groupBy") {
} else if (type === "groupBy" || type === "field") {
self.model.dispatch("toggleFilter", facetIdEl);
} else if (type === "favorite") {
event.stopImmediatePropagation();
Expand Down
19 changes: 18 additions & 1 deletion web_edit_user_filter/static/src/xml/backend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,24 @@

<div class="list-group">
<t t-foreach="values" t-as="value">
<t t-if="value.type != 'favorite'">
<t t-if="value.type == 'field'">
<t t-foreach="value.description" t-as="description">
<a
class="list-group-item list-group-item-action"
t-att-data-type="value.type"
t-att-data-id="value.id"
>
<span>
<t t-esc="description" />
</span>
<button class="btn btn-sm btn-link pull-right">
<span class="fa fa-close" />
</button>
</a>
<br />
</t>
</t>
<t t-if="value.type != 'favorite' and value.type != 'field'">
<a
class="list-group-item list-group-item-action"
t-att-data-type="value.type"
Expand Down

0 comments on commit 49e0014

Please sign in to comment.