From 5edaf83733d788f9a2a6aa86a6b703e7a24699cf Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Fri, 25 Nov 2022 13:20:01 +0530 Subject: [PATCH] fix: disbursable amount on currrent security price (cherry picked from commit fe87c27acdd54ac5ec1061eedcabbba148e60d5d) --- .../doctype/loan_disbursement/loan_disbursement.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py b/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py index 0c2042ba500b..ec117a12ad0e 100644 --- a/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py +++ b/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py @@ -191,7 +191,9 @@ def get_total_pledged_security_value(loan): for security, qty in pledged_securities.items(): after_haircut_percentage = 100 - hair_cut_map.get(security) - security_value += (loan_security_price_map.get(security) * qty * after_haircut_percentage) / 100 + security_value += ( + loan_security_price_map.get(security, 0) * qty * after_haircut_percentage + ) / 100 return security_value