From 37ae2dfe7f1557db37858dbd4bf0295c8ba99702 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Dec 2022 10:31:06 +0530 Subject: [PATCH] fix: reconciled credit notes being fetched again in Payment Reconciliation tool (#33471) fix: reconciled cr note showing up as Payments (cherry picked from commit 5ec11bad4fecc0bd3a16b53952608ce34e76ed00) --- .../payment_reconciliation/payment_reconciliation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 56c9ff07e26..f42583cb34c 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -172,22 +172,22 @@ class PaymentReconciliation(Document): query = ( qb.from_(gl) .select( - gl.voucher_type.as_("reference_type"), - gl.voucher_no.as_("reference_name"), + gl.against_voucher_type.as_("reference_type"), + gl.against_voucher.as_("reference_name"), (Sum(dr_or_cr) - Sum(reconciled_dr_or_cr)).as_("amount"), gl.posting_date, gl.account_currency.as_("currency"), ) .where( - (gl.voucher_type == voucher_type) - & (gl.voucher_no.isin(sub_query)) + (gl.against_voucher.isin(sub_query)) + & (gl.against_voucher_type == voucher_type) & (gl.is_cancelled == 0) & (gl.account == self.receivable_payable_account) & (gl.party_type == self.party_type) & (gl.party == self.party) ) .where(Criterion.all(conditions)) - .groupby(gl.voucher_no) + .groupby(gl.against_voucher) .having(qb.Field("amount") > 0) ) dr_cr_notes = query.run(as_dict=True)