fix: Loan disbursement amount validation (#24000)
This commit is contained in:
parent
e4755828c4
commit
a339752ba4
@ -332,6 +332,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_secured_loan",
|
||||
"fetch_from": "loan_application.maximum_loan_amount",
|
||||
"fieldname": "maximum_loan_amount",
|
||||
"fieldtype": "Currency",
|
||||
@ -352,7 +353,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-11-05 10:04:00.762975",
|
||||
"modified": "2020-11-24 12:27:23.208240",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Loan Management",
|
||||
"name": "Loan",
|
||||
|
@ -171,10 +171,10 @@ def get_total_pledged_security_value(loan):
|
||||
return security_value
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_disbursal_amount(loan):
|
||||
loan_details = frappe.get_all("Loan", fields = ["loan_amount", "disbursed_amount", "total_payment",
|
||||
"total_principal_paid", "total_interest_payable", "status", "is_term_loan", "is_secured_loan"],
|
||||
filters= { "name": loan })[0]
|
||||
def get_disbursal_amount(loan, on_current_security_price=0):
|
||||
loan_details = frappe.get_value("Loan", loan, ["loan_amount", "disbursed_amount", "total_payment",
|
||||
"total_principal_paid", "total_interest_payable", "status", "is_term_loan", "is_secured_loan",
|
||||
"maximum_loan_amount"], as_dict=1)
|
||||
|
||||
if loan_details.is_secured_loan and frappe.get_all('Loan Security Shortfall', filters={'loan': loan,
|
||||
'status': 'Pending'}):
|
||||
@ -188,9 +188,12 @@ def get_disbursal_amount(loan):
|
||||
- flt(loan_details.total_principal_paid)
|
||||
|
||||
security_value = 0.0
|
||||
if loan_details.is_secured_loan:
|
||||
if loan_details.is_secured_loan and on_current_security_price:
|
||||
security_value = get_total_pledged_security_value(loan)
|
||||
|
||||
if loan_details.is_secured_loan and not on_current_security_price:
|
||||
security_value = flt(loan_details.maximum_loan_amount)
|
||||
|
||||
if not security_value and not loan_details.is_secured_loan:
|
||||
security_value = flt(loan_details.loan_amount)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user