fix: Only submitted Loan security pledges should be approved
This commit is contained in:
parent
8e4ae0af56
commit
03b0ad4f98
@ -240,15 +240,19 @@ def unpledge_security(loan=None, loan_security_pledge=None, as_dict=0, save=0, s
|
||||
unpledge_request = create_loan_security_unpledge(security_map, pledge_doc.loan,
|
||||
pledge_doc.company, pledge_doc.applicant_type, pledge_doc.applicant)
|
||||
|
||||
if approve:
|
||||
unpledge_request.status = 'Approved'
|
||||
|
||||
if save:
|
||||
unpledge_request.save()
|
||||
|
||||
if submit:
|
||||
unpledge_request.submit()
|
||||
|
||||
if approve:
|
||||
if unpledge_request.docstatus == 1:
|
||||
unpledge_request.status = 'Approved'
|
||||
unpledge_request.save()
|
||||
else:
|
||||
frappe.throw(_('Only submittted unpledge requests can be approved'))
|
||||
|
||||
if as_dict:
|
||||
return unpledge_request
|
||||
else:
|
||||
|
@ -20,9 +20,6 @@ class LoanSecurityUnpledge(Document):
|
||||
self.update_loan_status(cancel=1)
|
||||
self.db_set('status', 'Requested')
|
||||
|
||||
def on_submit(self):
|
||||
self.approve()
|
||||
|
||||
def validate_duplicate_securities(self):
|
||||
security_list = []
|
||||
for d in self.securities:
|
||||
|
Loading…
x
Reference in New Issue
Block a user