fix: ignore cancelled dunnings
diff --git a/erpnext/accounts/doctype/dunning/dunning.py b/erpnext/accounts/doctype/dunning/dunning.py
index 0a55ff5..719f369 100644
--- a/erpnext/accounts/doctype/dunning/dunning.py
+++ b/erpnext/accounts/doctype/dunning/dunning.py
@@ -75,7 +75,8 @@
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 af83ef7..90966aa 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 @@
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: