Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bugs with creating loan with fixed amount repayment #188

Open
wants to merge 1 commit into
base: poc-staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lending/loan_management/doctype/loan/loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def set_available_limit_amount(self):
self.available_limit_amount = self.maximum_limit_amount

def validate_repayment_terms(self):
if self.is_term_loan and self.repayment_schedule_type != "Line of Credit":
if self.is_term_loan and self.repayment_schedule_type != "Line of Credit" and self.repayment_method == "Repay Over Number of Periods":
if not self.repayment_periods:
frappe.throw(_("Repayment periods is mandatory for term loans"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ def make_gl_entries(self, cancel=0, adv_adj=0):
[
"interest_receivable_account",
"penalty_receivable_account",
"suspense_interest_receivable",
"suspense_interest_income",
"interest_income_account",
"interest_waiver_account",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def make_repayment_schedule(
carry_forward_interest = self.adjusted_interest
moratorium_interest = 0

if not self.restructure_type:
if not self.restructure_type and self.repayment_method != "Repay Fixed Amount per Period":
monthly_repayment_amount = get_monthly_repayment_amount(
balance_amount, rate_of_interest, self.repayment_periods, self.repayment_frequency
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def add_restructure_charges(self):

for charge in frappe.get_all(
"Loan Charges",
filters={"parent": self.loan_product, "event": "Restructure"},
filters={"parent": self.loan_product},
fields=["charge_type", "charge_based_on", "amount", "percentage"],
):
if charge.charge_based_on == "Percentage":
Expand Down
Loading