From fee8340f9896a4884f077445924ea1a17e475843 Mon Sep 17 00:00:00 2001 From: Mitchy25 <42224026+Mitchy25@users.noreply.github.com> Date: Wed, 25 Dec 2019 01:32:18 +1300 Subject: [PATCH] fix: Bank Reconciliation Allows to Over Reconcile (#19461) * Update bank_reconciliation.py * fix: improve error message while over reconciling * fix: only check over-reconciliation when against payment entry Co-authored-by: Saqib --- .../page/bank_reconciliation/bank_reconciliation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py index bd4b4d7e0b1..69f9907a8d8 100644 --- a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py @@ -18,6 +18,10 @@ def reconcile(bank_transaction, payment_doctype, payment_name): account = frappe.db.get_value("Bank Account", transaction.bank_account, "account") gl_entry = frappe.get_doc("GL Entry", dict(account=account, voucher_type=payment_doctype, voucher_no=payment_name)) + if payment_doctype == "Payment Entry" and payment_entry.unallocated_amount > transaction.unallocated_amount: + frappe.throw(_("The unallocated amount of Payment Entry {0} \ + is greater than the Bank Transaction's unallocated amount").format(payment_name)) + if transaction.unallocated_amount == 0: frappe.throw(_("This bank transaction is already fully reconciled")) @@ -373,4 +377,4 @@ def sales_invoices_query(doctype, txt, searchfield, start, page_len, filters): 'start': start, 'page_len': page_len } - ) \ No newline at end of file + )