Skip to content

Commit

Permalink
Merge pull request #21 from bosue/no_zero_disbursement
Browse files Browse the repository at this point in the history
fix: Disallow zero disbursement
  • Loading branch information
deepeshgarg007 authored Sep 16, 2023
2 parents c7df023 + 6f53aa0 commit 1566693
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ def delete_security_deposit(self):
def validate_disbursal_amount(self):
possible_disbursal_amount = get_disbursal_amount(self.against_loan)

if self.disbursed_amount > possible_disbursal_amount:
if not self.disbursed_amount:
frappe.throw(_("Disbursed amount cannot be zero"))

elif self.disbursed_amount > possible_disbursal_amount:
frappe.throw(_("Disbursed Amount cannot be greater than {0}").format(possible_disbursal_amount))

def set_status_and_amounts(self, cancel=0):
Expand Down

1 comment on commit 1566693

@bosue
Copy link
Contributor

@bosue bosue commented on 1566693 Sep 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The extra line annoys me a bit, so as long as you can easily amend, that‘d be nice.
But then again, it‘s not a major problem, so nevermind.

Please sign in to comment.