Skip to content

Commit

Permalink
[FIX] web_edit_user_filter: Modified search facet
Browse files Browse the repository at this point in the history
      MOdified search facet for field type
  • Loading branch information
anusriNPS committed Oct 24, 2024
1 parent 6bf7534 commit fe7e8fa
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 fe7e8fa

Please sign in to comment.