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 <thefalconx33@gmail.com>
diff --git a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py
index bd4b4d7..69f9907 100644
--- a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py
+++ b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py
@@ -18,6 +18,10 @@
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 @@
'start': start,
'page_len': page_len
}
- )
\ No newline at end of file
+ )