fix: ignore cancelled dunnings

This commit is contained in:
barredterra 2021-11-12 23:24:08 +01:00 committed by marination
parent 0a06241e7c
commit 8bfe865759
2 changed files with 3 additions and 2 deletions

View File

@ -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"
)

View File

@ -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: