Merge pull request #24468 from deepeshgarg007/lse_report_fix
fix: Division by 0 error in security exposure reports
This commit is contained in:
commit
ff3adfd1cf
@ -43,6 +43,7 @@ def get_data(filters):
|
||||
currency = erpnext.get_company_currency(filters.get('company'))
|
||||
|
||||
for key, qty in iteritems(pledge_values):
|
||||
if qty:
|
||||
row = {}
|
||||
current_value = flt(qty * loan_security_details.get(key[1], {}).get('latest_price', 0))
|
||||
valid_upto = loan_security_details.get(key[1], {}).get('valid_upto')
|
||||
@ -54,7 +55,8 @@ def get_data(filters):
|
||||
'total_qty': qty,
|
||||
'current_value': current_value,
|
||||
'price_valid_upto': valid_upto,
|
||||
'portfolio_percent': flt(current_value * 100 / total_value_map.get(key[0]), 2),
|
||||
'portfolio_percent': flt(current_value * 100 / total_value_map.get(key[0]), 2) if total_value_map.get(key[0]) \
|
||||
else 0.0,
|
||||
'currency': currency
|
||||
})
|
||||
|
||||
|
@ -40,6 +40,7 @@ def get_data(filters):
|
||||
currency = erpnext.get_company_currency(filters.get('company'))
|
||||
|
||||
for security, value in iteritems(current_pledges):
|
||||
if value.get('qty'):
|
||||
row = {}
|
||||
current_value = flt(value.get('qty', 0) * loan_security_details.get(security, {}).get('latest_price', 0))
|
||||
valid_upto = loan_security_details.get(security, {}).get('valid_upto')
|
||||
|
Loading…
x
Reference in New Issue
Block a user