fix: Loan Interest accruals for 0 rated loans
This commit is contained in:
parent
ffa3071d36
commit
eefc9b7172
@ -236,7 +236,6 @@ def get_term_loans(date, term_loan=None, loan_type=None):
|
|||||||
AND l.is_term_loan =1
|
AND l.is_term_loan =1
|
||||||
AND rs.payment_date <= %s
|
AND rs.payment_date <= %s
|
||||||
AND rs.is_accrued=0 {0}
|
AND rs.is_accrued=0 {0}
|
||||||
AND rs.interest_amount > 0
|
|
||||||
AND l.status = 'Disbursed'
|
AND l.status = 'Disbursed'
|
||||||
ORDER BY rs.payment_date""".format(
|
ORDER BY rs.payment_date""".format(
|
||||||
condition
|
condition
|
||||||
|
@ -735,6 +735,7 @@ def get_amounts(amounts, against_loan, posting_date):
|
|||||||
)
|
)
|
||||||
amounts["pending_accrual_entries"] = pending_accrual_entries
|
amounts["pending_accrual_entries"] = pending_accrual_entries
|
||||||
amounts["unaccrued_interest"] = flt(unaccrued_interest, precision)
|
amounts["unaccrued_interest"] = flt(unaccrued_interest, precision)
|
||||||
|
amounts["written_off_amount"] = flt(against_loan_doc.written_off_amount, precision)
|
||||||
|
|
||||||
if final_due_date:
|
if final_due_date:
|
||||||
amounts["due_date"] = final_due_date
|
amounts["due_date"] = final_due_date
|
||||||
|
@ -57,7 +57,7 @@ def process_loan_interest_accrual_for_demand_loans(
|
|||||||
|
|
||||||
def process_loan_interest_accrual_for_term_loans(posting_date=None, loan_type=None, loan=None):
|
def process_loan_interest_accrual_for_term_loans(posting_date=None, loan_type=None, loan=None):
|
||||||
|
|
||||||
if not term_loan_accrual_pending(posting_date or nowdate()):
|
if not term_loan_accrual_pending(posting_date or nowdate(), loan=loan):
|
||||||
return
|
return
|
||||||
|
|
||||||
loan_process = frappe.new_doc("Process Loan Interest Accrual")
|
loan_process = frappe.new_doc("Process Loan Interest Accrual")
|
||||||
@ -71,9 +71,12 @@ def process_loan_interest_accrual_for_term_loans(posting_date=None, loan_type=No
|
|||||||
return loan_process.name
|
return loan_process.name
|
||||||
|
|
||||||
|
|
||||||
def term_loan_accrual_pending(date):
|
def term_loan_accrual_pending(date, loan=None):
|
||||||
pending_accrual = frappe.db.get_value(
|
filters = {"payment_date": ("<=", date), "is_accrued": 0}
|
||||||
"Repayment Schedule", {"payment_date": ("<=", date), "is_accrued": 0}
|
|
||||||
)
|
if loan:
|
||||||
|
filters.update({"parent": loan})
|
||||||
|
|
||||||
|
pending_accrual = frappe.db.get_value("Repayment Schedule", filters)
|
||||||
|
|
||||||
return pending_accrual
|
return pending_accrual
|
||||||
|
Loading…
Reference in New Issue
Block a user