Skip to content

Commit

Permalink
Merge pull request frappe#23022 from marination/loan-amount
Browse files Browse the repository at this point in the history
fix: Validate or Set Loan Amount first
  • Loading branch information
deepeshgarg007 authored Aug 13, 2020
2 parents d7d92c5 + 1151f88 commit 8ca57eb
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@

class LoanApplication(Document):
def validate(self):

validate_repayment_method(self.repayment_method, self.loan_amount, self.repayment_amount,
self.repayment_periods, self.is_term_loan)

self.validate_loan_type()
self.set_pledge_amount()
self.set_loan_amount()
self.validate_loan_amount()

if self.is_term_loan:
validate_repayment_method(self.repayment_method, self.loan_amount, self.repayment_amount,
self.repayment_periods, self.is_term_loan)

self.validate_loan_type()

self.get_repayment_details()
self.check_sanctioned_amount_limit()

Expand Down Expand Up @@ -106,7 +108,7 @@ def set_loan_amount(self):
if self.is_secured_loan and self.proposed_pledges:
self.maximum_loan_amount = 0
for security in self.proposed_pledges:
self.maximum_loan_amount += security.post_haircut_amount
self.maximum_loan_amount += flt(security.post_haircut_amount)

if not self.loan_amount and self.is_secured_loan and self.proposed_pledges:
self.loan_amount = self.maximum_loan_amount
Expand Down

0 comments on commit 8ca57eb

Please sign in to comment.