Merge pull request #23287 from deepeshgarg007/lsu_api_fix

fix: Only submitted Loan security pledges should be approved
This commit is contained in:
Deepesh Garg 2020-09-07 23:23:55 +05:30 committed by GitHub
commit b828e2fcf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -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:

View File

@ -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: