From b9a249918a644b48896b3aecaf9d38e8bf6b4519 Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Wed, 14 Sep 2022 11:55:03 +0530 Subject: [PATCH 1/2] fix: pending accrual entries (cherry picked from commit f2209045f8e0deceaa4e743c40ac2fe037d85e3a) --- .../doctype/loan_repayment/loan_repayment.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py index 9b7603fc3b3..a69660dabf3 100644 --- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py +++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py @@ -516,6 +516,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, @@ -536,6 +538,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 From 64aad8868414864d089bc552a196c843aae1c02c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 14 Sep 2022 19:21:40 +0530 Subject: [PATCH 2/2] fix: correct sql output format in CRM patch (backport #32213) (#32215) fix: correct sql output format in CRM patch (#32213) (cherry picked from commit 97977cdb4ba42a1a20a6e747cc5586ae92e8954b) Co-authored-by: Ankush Menat --- .../v14_0/migrate_existing_lead_notes_as_per_the_new_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v14_0/migrate_existing_lead_notes_as_per_the_new_format.py b/erpnext/patches/v14_0/migrate_existing_lead_notes_as_per_the_new_format.py index 032aeccc23d..ec72527552c 100644 --- a/erpnext/patches/v14_0/migrate_existing_lead_notes_as_per_the_new_format.py +++ b/erpnext/patches/v14_0/migrate_existing_lead_notes_as_per_the_new_format.py @@ -12,7 +12,7 @@ def execute(): frappe.qb.from_(dt) .select(dt.name, dt.notes, dt.modified_by, dt.modified) .where(dt.notes.isnotnull() & dt.notes != "") - ).run() + ).run(as_dict=True) for d in records: if strip_html(cstr(d.notes)).strip():