fix: Loan seurity unpledge msg improvement
This commit is contained in:
parent
3e69756e15
commit
3899079bb9
@ -22,7 +22,7 @@ def update_shortfall_status(loan, security_value):
|
||||
if security_value >= loan_security_shortfall.shortfall_amount:
|
||||
frappe.db.set_value("Loan Security Shortfall", loan_security_shortfall.name, {
|
||||
"status": "Completed",
|
||||
"shortfall_value": loan_security_shortfall.shortfall_amount})
|
||||
"shortfall_amount": loan_security_shortfall.shortfall_amount})
|
||||
else:
|
||||
frappe.db.set_value("Loan Security Shortfall", loan_security_shortfall.name,
|
||||
"shortfall_amount", loan_security_shortfall.shortfall_amount - security_value)
|
||||
|
@ -67,10 +67,18 @@ class LoanSecurityUnpledge(Document):
|
||||
security_value += qty_after_unpledge * current_price
|
||||
|
||||
if not security_value and flt(pending_principal_amount, 2) > 0:
|
||||
frappe.throw("Cannot Unpledge, loan to value ratio is breaching")
|
||||
self._throw(security_value, pending_principal_amount, ltv_ratio)
|
||||
|
||||
if security_value and flt(pending_principal_amount/security_value) * 100 > ltv_ratio:
|
||||
frappe.throw("Cannot Unpledge, loan to value ratio is breaching")
|
||||
self._throw(security_value, pending_principal_amount, ltv_ratio)
|
||||
|
||||
def _throw(self, security_value, pending_principal_amount, ltv_ratio):
|
||||
msg = _("Loan Security Value after unpledge is {0}").format(frappe.bold(security_value))
|
||||
msg += '<br>'
|
||||
msg += _("Pending principal amount is {0}").format(frappe.bold(flt(pending_principal_amount, 2)))
|
||||
msg += '<br>'
|
||||
msg += _("Loan To Security Value ratio must always be {0}").format(frappe.bold(ltv_ratio))
|
||||
frappe.throw(msg, title=_("Loan To Value ratio breach"))
|
||||
|
||||
def on_update_after_submit(self):
|
||||
self.approve()
|
||||
|
@ -10,6 +10,7 @@
|
||||
"loan_type",
|
||||
"loan",
|
||||
"process_type",
|
||||
"accrual_type",
|
||||
"amended_from"
|
||||
],
|
||||
"fields": [
|
||||
@ -47,12 +48,18 @@
|
||||
"hidden": 1,
|
||||
"label": "Process Type",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "accrual_type",
|
||||
"fieldtype": "Select",
|
||||
"label": "Accrual Type",
|
||||
"options": "Regular\nRepayment\nDisbursement"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-11-05 10:49:35.657728",
|
||||
"modified": "2020-11-06 04:43:56.581670",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Loan Management",
|
||||
"name": "Process Loan Interest Accrual",
|
||||
|
@ -20,11 +20,11 @@ class ProcessLoanInterestAccrual(Document):
|
||||
|
||||
if (not self.loan or not loan_doc.is_term_loan) and self.process_type != 'Term Loans':
|
||||
make_accrual_interest_entry_for_demand_loans(self.posting_date, self.name,
|
||||
open_loans = open_loans, loan_type = self.loan_type)
|
||||
open_loans = open_loans, loan_type = self.loan_type, accrual_type=self.accrual_type)
|
||||
|
||||
if (not self.loan or loan_doc.is_term_loan) and self.process_type != 'Demand Loans':
|
||||
make_accrual_interest_entry_for_term_loans(self.posting_date, self.name, term_loan=self.loan,
|
||||
loan_type=self.loan_type)
|
||||
loan_type=self.loan_type, accrual_type=self.accrual_type)
|
||||
|
||||
|
||||
def process_loan_interest_accrual_for_demand_loans(posting_date=None, loan_type=None, loan=None, accrual_type="Regular"):
|
||||
|
Loading…
x
Reference in New Issue
Block a user