fix: summary report filters
This commit is contained in:
parent
e7239e02d4
commit
f7cb68a45f
@ -72,18 +72,11 @@ frappe.query_reports["Accounts Payable Summary"] = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "party_type",
|
"fieldname":"party_type",
|
||||||
"label": __("Party Type"),
|
"label": __("Party Type"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Autocomplete",
|
||||||
"options": "Party Type",
|
options: get_party_type_options(),
|
||||||
get_query: () => {
|
on_change: function() {
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
'account_type': 'Payable'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
on_change: () => {
|
|
||||||
frappe.query_report.set_filter_value('party', "");
|
frappe.query_report.set_filter_value('party', "");
|
||||||
frappe.query_report.toggle_filter_display('supplier_group', frappe.query_report.get_filter_value('party_type') !== "Supplier");
|
frappe.query_report.toggle_filter_display('supplier_group', frappe.query_report.get_filter_value('party_type') !== "Supplier");
|
||||||
}
|
}
|
||||||
@ -91,8 +84,15 @@ frappe.query_reports["Accounts Payable Summary"] = {
|
|||||||
{
|
{
|
||||||
"fieldname":"party",
|
"fieldname":"party",
|
||||||
"label": __("Party"),
|
"label": __("Party"),
|
||||||
"fieldtype": "Dynamic Link",
|
"fieldtype": "MultiSelectList",
|
||||||
"options": "party_type",
|
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);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"payment_terms_template",
|
"fieldname":"payment_terms_template",
|
||||||
@ -122,3 +122,15 @@ frappe.query_reports["Accounts Payable Summary"] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
erpnext.utils.add_dimensions('Accounts Payable Summary', 9);
|
erpnext.utils.add_dimensions('Accounts Payable Summary', 9);
|
||||||
|
|
||||||
|
function get_party_type_options() {
|
||||||
|
let options = [];
|
||||||
|
frappe.db.get_list(
|
||||||
|
"Party Type", {filters:{"account_type": "Payable"}, fields:['name']}
|
||||||
|
).then((res) => {
|
||||||
|
res.forEach((party_type) => {
|
||||||
|
options.push(party_type.name);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return options;
|
||||||
|
}
|
@ -72,19 +72,11 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "party_type",
|
"fieldname":"party_type",
|
||||||
"label": __("Party Type"),
|
"label": __("Party Type"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Autocomplete",
|
||||||
"options": "Party Type",
|
options: get_party_type_options(),
|
||||||
"Default": "Customer",
|
on_change: function() {
|
||||||
get_query: () => {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
'account_type': 'Receivable'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
on_change: () => {
|
|
||||||
frappe.query_report.set_filter_value('party', "");
|
frappe.query_report.set_filter_value('party', "");
|
||||||
frappe.query_report.toggle_filter_display('customer_group', frappe.query_report.get_filter_value('party_type') !== "Customer");
|
frappe.query_report.toggle_filter_display('customer_group', frappe.query_report.get_filter_value('party_type') !== "Customer");
|
||||||
}
|
}
|
||||||
@ -92,8 +84,15 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
|||||||
{
|
{
|
||||||
"fieldname":"party",
|
"fieldname":"party",
|
||||||
"label": __("Party"),
|
"label": __("Party"),
|
||||||
"fieldtype": "Dynamic Link",
|
"fieldtype": "MultiSelectList",
|
||||||
"options": "party_type",
|
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);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"customer_group",
|
"fieldname":"customer_group",
|
||||||
@ -151,3 +150,15 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
erpnext.utils.add_dimensions('Accounts Receivable Summary', 9);
|
erpnext.utils.add_dimensions('Accounts Receivable Summary', 9);
|
||||||
|
|
||||||
|
function get_party_type_options() {
|
||||||
|
let options = [];
|
||||||
|
frappe.db.get_list(
|
||||||
|
"Party Type", {filters:{"account_type": "Receivable"}, fields:['name']}
|
||||||
|
).then((res) => {
|
||||||
|
res.forEach((party_type) => {
|
||||||
|
options.push(party_type.name);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return options;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user