fix: Add filter for outstanding_amount to fetch open PRs

(cherry picked from commit 214dfab269)
This commit is contained in:
Abdeali Chharchhoda
2024-11-27 17:18:10 +05:30
committed by Mergify
parent eb809847f1
commit 7e847f27dd

View File

@@ -2605,6 +2605,7 @@ def get_open_payment_requests_for_references(references=None):
.where(Tuple(PR.reference_doctype, PR.reference_name).isin(list(refs)))
.where(PR.status != "Paid")
.where(PR.docstatus == 1)
.where(PR.outstanding_amount > 0) # to avoid old PRs with 0 outstanding amount
.orderby(Coalesce(PR.transaction_date, PR.creation), order=frappe.qb.asc)
).run(as_dict=True)