From a589f1b9bbd917394dbe4f6f0c925bfa9f0fa2f1 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Wed, 16 Oct 2024 12:11:16 +0530 Subject: [PATCH] fix: Loan Security Exposure report --- .../report/loan_security_exposure/loan_security_exposure.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lending/loan_management/report/loan_security_exposure/loan_security_exposure.py b/lending/loan_management/report/loan_security_exposure/loan_security_exposure.py index af9a9421..94b8198f 100644 --- a/lending/loan_management/report/loan_security_exposure/loan_security_exposure.py +++ b/lending/loan_management/report/loan_security_exposure/loan_security_exposure.py @@ -110,6 +110,9 @@ def get_data(filters): value.get("qty", 0) * loan_security_details.get(security, {}).get("latest_price", 0) ) valid_upto = loan_security_details.get(security, {}).get("valid_upto") + portfolio_percent = ( + flt(current_value * 100 / total_portfolio_value, 2) if total_portfolio_value != 0 else 0.0 + ) row.update(loan_security_details.get(security)) row.update( @@ -117,7 +120,7 @@ def get_data(filters): "total_qty": value.get("qty"), "current_value": current_value, "price_valid_upto": valid_upto, - "portfolio_percent": flt(current_value * 100 / total_portfolio_value, 2), + "portfolio_percent": portfolio_percent, "pledged_applicant_count": value.get("applicant_count"), "currency": currency, }