frappe.listview_settings[‘Purchase Invoice’] = {
onload: function(listview) {
frappe.call({
method: “demo_app.public.python.listview_all.user_filter”,
callback: function(r) {
frappe.route_options = {“supplier”: [“=”, “SUP-2023-00116”]}
}
});
},
};
Hi @RK_1214,
Please check its syntax.
frappe.listview_settings['Purchase Invoice'] = {
onload : function(listview) {
frappe.route_options = {
"supplier": "Supplier 1"
};
listview.refresh();
}
};
Output:
When reloading the doctype then automatically filter will set.
Please set it according to scenario.
Thank You!
Thank you for reply,
But frappe.route_options not work in frappe.call()
please add this after your code.
listview.refresh();
then check it.
frappe.listview_settings[‘Purchase Invoice’] = {
onload: function(listview) {
frappe.call({
method: “demo_app.public.python.listview_all.user_filter”,
callback: function(r) {
frappe.route_options = {“supplier”: [“=”, “SUP-2023-00116”]}
listview.refresh();
}
});
},
};
Not working
frappe.call not work in frappe.listview_settings ,
for that use like this
let user_l = [];
frappe.call({
method: "demo_app.public.python.listview_all.user_filter",
args: { doctype: doc },
}).then(function(r) {
user_l.push(r.message);
});
frappe.listview_settings['Purchase Invoice'] = {
onload: function(r) {
frappe.route_options = []
frappe.route_options = user_l[0]
}
};
1 Like