fix: Correct dunnings resolving after PE submit (#41792)

Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
This commit is contained in:
tonspar
2024-06-28 13:47:51 +02:00
committed by GitHub
parent 0c5cda1380
commit affaaee1f4

View File

@@ -193,10 +193,13 @@ def resolve_dunning(doc, state):
outstanding_ps = frappe.get_value(
"Payment Schedule", overdue_payment.payment_schedule, "outstanding"
)
resolve = False if (outstanding_ps > 0 and outstanding_inv > 0) else True
resolve = resolve and (False if (outstanding_ps > 0 and outstanding_inv > 0) else True)
dunning.status = "Resolved" if resolve else "Unresolved"
dunning.save()
new_status = "Resolved" if resolve else "Unresolved"
if dunning.status != new_status:
dunning.status = new_status
dunning.save()
def get_linked_dunnings_as_per_state(sales_invoice, state):