let say I want multiple companies(selected) sales report. How can I add a multi-select dropdown? can you help with this I can’t find any solution to this query @rmehta
thanks
Sumanth
let say I want multiple companies(selected) sales report. How can I add a multi-select dropdown? can you help with this I can’t find any solution to this query @rmehta
thanks
Sumanth
Try this one in your reports js file.
{
"fieldname":"party",
"label": __("Party"),
"fieldtype": "MultiSelectList",
"reqd": 1,
get_data: function(txt) {
if (!frappe.query_report.filters) return;
let party_type = frappe.query_report.get_filter_value('party_type');
if (!party_type) return;
return frappe.db.get_link_options(party_type, txt);
},
on_change: function() {
var party_type = frappe.query_report.get_filter_value('party_type');
var parties = frappe.query_report.get_filter_value('party');
if(!party_type || parties.length === 0 || parties.length > 1) {
frappe.query_report.set_filter_value('party_name', "");
frappe.query_report.set_filter_value('tax_id', "");
return;
} else {
var party = parties[0];
/*var fieldname = erpnext.utils.get_party_name(party_type) || "name";
frappe.db.get_value(party_type, party, fieldname, function(value) {
frappe.query_report.set_filter_value('party_name', value[fieldname]);
});*/
if (party_type === "Customer" || party_type === "Supplier") {
frappe.db.get_value(party_type, party, "tax_id", function(value) {
frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
});
}
}
}
}
Source: ERPNext-Turkish-Delight/cari_ekstre_ozet.js at master · logedosoft/ERPNext-Turkish-Delight · GitHub