Merge pull request #32208 from abhinavxd/fix-pending-accrual-entries

fix: Loans pending accrual entries
This commit is contained in:
Deepesh Garg 2022-09-14 14:14:44 +05:30 committed by GitHub
commit 87160c8d2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -519,6 +519,8 @@ def get_accrued_interest_entries(against_loan, posting_date=None):
if not posting_date:
posting_date = getdate()
precision = cint(frappe.db.get_default("currency_precision")) or 2
unpaid_accrued_entries = frappe.db.sql(
"""
SELECT name, posting_date, interest_amount - paid_interest_amount as interest_amount,
@ -539,6 +541,13 @@ def get_accrued_interest_entries(against_loan, posting_date=None):
as_dict=1,
)
# Skip entries with zero interest amount & payable principal amount
unpaid_accrued_entries = [
d
for d in unpaid_accrued_entries
if flt(d.interest_amount, precision) > 0 or flt(d.payable_principal_amount, precision) > 0
]
return unpaid_accrued_entries