From 86bac2cf52e6094755e8f21df871a7f56a4d53a5 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 4 Jul 2023 09:02:05 +0530 Subject: [PATCH] refactor: filter on advance payments --- .../doctype/payment_reconciliation/payment_reconciliation.py | 3 +++ erpnext/controllers/accounts_controller.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index a724dbfa75..5f69c6720b 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -75,6 +75,9 @@ class PaymentReconciliation(Document): } ) + if self.payment_name: + condition.update({"name": self.payment_name}) + payment_entries = get_advance_payment_entries( self.party_type, self.party, diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index fbf97aab59..7e43dbcd20 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -2396,6 +2396,9 @@ def get_common_query( q = q.select((payment_entry.target_exchange_rate).as_("exchange_rate")) if condition: + if condition.get("name", None): + q = q.where(payment_entry.name.like(f"%{condition.get('name')}%")) + q = q.where(payment_entry.company == condition["company"]) q = ( q.where(payment_entry.posting_date >= condition["from_payment_date"])