From 8bfe8657596168d9ebf921bbbd21b7a6d81fa37f Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Fri, 12 Nov 2021 23:24:08 +0100 Subject: [PATCH] fix: ignore cancelled dunnings --- erpnext/accounts/doctype/dunning/dunning.py | 3 ++- erpnext/patches/v14_0/single_to_multi_dunning.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/dunning/dunning.py b/erpnext/accounts/doctype/dunning/dunning.py index 0a55ff5f5f..719f3698dc 100644 --- a/erpnext/accounts/doctype/dunning/dunning.py +++ b/erpnext/accounts/doctype/dunning/dunning.py @@ -75,7 +75,8 @@ def resolve_dunning(doc, state): unresolved_dunnings = frappe.get_all("Dunning", filters={ "sales_invoice": reference.reference_name, - "status": ("!=", "Resolved") + "status": ("!=", "Resolved"), + "docstatus": ("!=", 2), }, pluck="name" ) diff --git a/erpnext/patches/v14_0/single_to_multi_dunning.py b/erpnext/patches/v14_0/single_to_multi_dunning.py index af83ef7096..90966aa4cb 100644 --- a/erpnext/patches/v14_0/single_to_multi_dunning.py +++ b/erpnext/patches/v14_0/single_to_multi_dunning.py @@ -7,7 +7,7 @@ def execute(): frappe.reload_doc("accounts", "doctype", "overdue_payment") frappe.reload_doc("accounts", "doctype", "dunning") - all_dunnings = frappe.get_all("Dunning", pluck="name") + all_dunnings = frappe.get_all("Dunning", filters={"docstatus": ("!=", 2)}, pluck="name") for dunning_name in all_dunnings: dunning = frappe.get_doc("Dunning", dunning_name) if not dunning.sales_invoice: