Skip to content

Commit

Permalink
fix: AP & AR summary filters to match AR (backport #37248) (#37261)
Browse files Browse the repository at this point in the history
* fix: set AR filters after rename

(cherry picked from commit 832d7e7)

* fix: change filters for AR summary

(cherry picked from commit 7d96044)

* fix: set new AP summary filters

(cherry picked from commit 76a5d94)

---------

Co-authored-by: Gursheen Anand <gursheen@frappe.io>
  • Loading branch information
mergify[bot] and GursheenK authored Sep 27, 2023
1 parent 0a0d5b3 commit 1dc58b3
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def get_gl_filters(doc, entry, tax_id, presentation_currency):
def get_ar_filters(doc, entry):
return {
"report_date": doc.posting_date if doc.posting_date else None,
"customer": entry.customer,
"party_type": "Customer",
"party": entry.customer,
"customer_name": entry.customer_name if entry.customer_name else None,
"payment_terms_template": doc.payment_terms_template if doc.payment_terms_template else None,
"sales_partner": doc.sales_partner if doc.sales_partner else None,
Expand Down
3 changes: 0 additions & 3 deletions erpnext/accounts/report/accounts_payable/accounts_payable.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,8 @@ frappe.query_reports["Accounts Payable"] = {
},
on_change: () => {
frappe.query_report.set_filter_value('party', "");
let party_type = frappe.query_report.get_filter_value('party_type');
frappe.query_report.toggle_filter_display('supplier_group', frappe.query_report.get_filter_value('party_type') !== "Supplier");

}

},
{
"fieldname":"party",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,27 @@ frappe.query_reports["Accounts Payable Summary"] = {
}
},
{
"fieldname":"supplier",
"label": __("Supplier"),
"fieldname": "party_type",
"label": __("Party Type"),
"fieldtype": "Link",
"options": "Supplier"
"options": "Party Type",
get_query: () => {
return {
filters: {
'account_type': 'Payable'
}
};
},
on_change: () => {
frappe.query_report.set_filter_value('party', "");
frappe.query_report.toggle_filter_display('supplier_group', frappe.query_report.get_filter_value('party_type') !== "Supplier");
}
},
{
"fieldname":"party",
"label": __("Party"),
"fieldtype": "Dynamic Link",
"options": "party_type",
},
{
"fieldname":"payment_terms_template",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ frappe.query_reports["Accounts Receivable"] = {
},
on_change: () => {
frappe.query_report.set_filter_value('party', "");
let party_type = frappe.query_report.get_filter_value('party_type');
frappe.query_report.toggle_filter_display('customer_group', frappe.query_report.get_filter_value('party_type') !== "Customer");

}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,28 @@ frappe.query_reports["Accounts Receivable Summary"] = {
}
},
{
"fieldname":"customer",
"label": __("Customer"),
"fieldname": "party_type",
"label": __("Party Type"),
"fieldtype": "Link",
"options": "Customer"
"options": "Party Type",
"Default": "Customer",
get_query: () => {
return {
filters: {
'account_type': 'Receivable'
}
};
},
on_change: () => {
frappe.query_report.set_filter_value('party', "");
frappe.query_report.toggle_filter_display('customer_group', frappe.query_report.get_filter_value('party_type') !== "Customer");
}
},
{
"fieldname":"party",
"label": __("Party"),
"fieldtype": "Dynamic Link",
"options": "party_type",
},
{
"fieldname":"customer_group",
Expand Down

0 comments on commit 1dc58b3

Please sign in to comment.