From b1818137e7f4cdc145e2d84a8247af27c93c975a Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Thu, 27 Jul 2023 10:08:26 +0530 Subject: [PATCH] fix: PE in sales register --- .../accounts/report/purchase_register/purchase_register.py | 1 + erpnext/accounts/report/sales_register/sales_register.py | 1 + erpnext/accounts/report/utils.py | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index 819da78291c..c7b7e2f7c12 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -422,6 +422,7 @@ def get_invoices(filters, additional_query_columns): def get_payments(filters): args = frappe._dict( account="credit_to", + account_fieldname="paid_to", party="supplier", party_name="supplier_name", party_account=get_party_account( diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py index b84f2597b62..c2d29444089 100644 --- a/erpnext/accounts/report/sales_register/sales_register.py +++ b/erpnext/accounts/report/sales_register/sales_register.py @@ -462,6 +462,7 @@ def get_invoices(filters, additional_query_columns): def get_payments(filters): args = frappe._dict( account="debit_to", + account_fieldname="paid_from", party="customer", party_name="customer_name", party_account=get_party_account( diff --git a/erpnext/accounts/report/utils.py b/erpnext/accounts/report/utils.py index 68a4281bf12..0753fff8344 100644 --- a/erpnext/accounts/report/utils.py +++ b/erpnext/accounts/report/utils.py @@ -269,7 +269,7 @@ def get_payment_entries(filters, args): ConstantColumn("Payment Entry").as_("doctype"), pe.name, pe.posting_date, - pe.paid_to.as_(args.account), + pe[args.account_fieldname].as_(args.account), pe.party.as_(args.party), pe.party_name.as_(args.party_name), pe.remarks, @@ -279,7 +279,9 @@ def get_payment_entries(filters, args): pe.project, pe.cost_center, ) - .where((pe.party == filters.get(args.party)) & (pe.paid_to.isin(args.party_account))) + .where( + (pe.party == filters.get(args.party)) & (pe[args.account_fieldname].isin(args.party_account)) + ) .orderby(pe.posting_date, pe.name, order=Order.desc) ) query = get_conditions(filters, query, doctype="Payment Entry", payments=True)