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>
This commit is contained in:
Mitchy25 2019-12-25 01:32:18 +13:00 committed by Saqib
parent ec258a43d9
commit fee8340f98

View File

@ -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
}
)
)