Skip to content

Commit

Permalink
fix: Only submitted Loan security pledges should be approved
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 committed Sep 7, 2020
1 parent 8e4ae0a commit 03b0ad4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 7 additions & 3 deletions erpnext/loan_management/doctype/loan/loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ def on_cancel(self):
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:
Expand Down

0 comments on commit 03b0ad4

Please sign in to comment.