fix: transform filter correctly to match route options

This commit is contained in:
sokumon 2026-02-05 14:23:05 +05:30
parent 9b24450337
commit 231289c233

View file

@ -60,6 +60,7 @@ frappe.ui.sidebar_item.TypeLink = class SidebarItem {
let filters_json = JSON.parse(
frappe.utils.get_filter_as_json(JSON.parse(this.item.filters))
);
filters_json = this.transform_filters(filters_json);
if (this.item.link_type == "DocType") {
args.doc_view = "List";
args.route_options = filters_json;
@ -72,6 +73,15 @@ frappe.ui.sidebar_item.TypeLink = class SidebarItem {
return encodeURI(path);
}
}
transform_filters(filters_json) {
for (const [key, value] of Object.entries(filters_json)) {
if (Array.isArray(value)) {
filters_json[key] = value[1];
}
}
return filters_json;
}
prepare() {}
make() {
this.path = this.get_path();