From 831828686587e42881ba0f9131a7c605569c1ba0 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 30 Apr 2024 17:06:48 +0530 Subject: [PATCH] fix: validation to prevent overallocation (cherry picked from commit bf755fab550134fccc344dd220143bf0a4fb4a8c) --- erpnext/accounts/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index d966074b2ae..8fc47b0b679 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -479,6 +479,11 @@ def reconcile_against_document( # re-submit advance entry doc = frappe.get_doc(entry.voucher_type, entry.voucher_no) gl_map = doc.build_gl_map() + from erpnext.accounts.general_ledger import process_debit_credit_difference + + # Make sure there is no overallocation + process_debit_credit_difference(gl_map) + create_payment_ledger_entry(gl_map, update_outstanding="No", cancel=0, adv_adj=1) # Only update outstanding for newly linked vouchers