From e37f98267bb4691ef108fa81546335e741f56639 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 21 Oct 2021 20:53:26 +0200 Subject: [PATCH] fix: resolve dunning --- erpnext/accounts/doctype/dunning/dunning.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/dunning/dunning.py b/erpnext/accounts/doctype/dunning/dunning.py index 941a91df5f..0a55ff5f5f 100644 --- a/erpnext/accounts/doctype/dunning/dunning.py +++ b/erpnext/accounts/doctype/dunning/dunning.py @@ -84,8 +84,9 @@ def resolve_dunning(doc, state): resolve = True dunning = frappe.get_doc("Dunning", dunning_name) for overdue_payment in dunning.overdue_payments: - outstanding = frappe.get_value("Payment Schedule", overdue_payment.payment_schedule, "outstanding") - if outstanding >= 0: + outstanding_inv = frappe.get_value("Sales Invoice", overdue_payment.sales_invoice, "outstanding_amount") + outstanding_ps = frappe.get_value("Payment Schedule", overdue_payment.payment_schedule, "outstanding") + if outstanding_ps > 0 and outstanding_inv > 0: resolve = False if resolve: