I’m trying to filter Items by Item Group in Sales Invoice. The only solution that seems to work consistently for me is the depreciated cur_frm.cscript…
I wanted to make it work using this code:
frappe.ui.form.on('Sales Invoice', {
refresh : function(frm, cdt, cdn) {
frm.set_query("item_code", "items", function() {
return {
filters: {"item_group": "Products"}
}
});
}
});
also onload instead of refresh doesn’t work.
But this depreciated code works without any problems:
cur_frm.cscript.onload = function(frm) {
cur_frm.set_query("item_code", "items", function() {
return {
filters: {"item_group": "Products"}
}
});
}
Any reason why this is? And how to make the non depreciated snippet work?