fix(accounts): skip discount settled terms in zero portion outstanding patch

(cherry picked from commit a4b6304881)
This commit is contained in:
Sudharsanan11
2026-10-29 19:15:08 +05:30
parent d41f2310c9
commit 6b76b2ef09
@@ -6,7 +6,8 @@ def execute():
ps = DocType("Payment Schedule")
for parenttype in ("Sales Invoice", "Purchase Invoice", "Sales Order", "Purchase Order"):
parent = DocType(parenttype)
outstanding = ps.payment_amount - ps.paid_amount
settled = ps.paid_amount + ps.discounted_amount
outstanding = ps.payment_amount - settled
(
frappe.qb.update(ps)
@@ -20,6 +21,6 @@ def execute():
& (parent.docstatus == 1)
& (ps.invoice_portion == 0)
& (ps.outstanding == 0)
& (ps.paid_amount < ps.payment_amount)
& (settled < ps.payment_amount)
)
).run()