Skip to content

Commit

Permalink
Merge pull request #44239 from frappe/mergify/bp/version-15-hotfix/pr…
Browse files Browse the repository at this point in the history
…-44220

refactor: Update `Payment Request` search query in PE's reference (backport #44220)
  • Loading branch information
ruthra-kumar authored Nov 20, 2024
2 parents a0ea684 + 514fe69 commit 9ce1c25
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions erpnext/accounts/doctype/payment_request/payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,17 +945,18 @@ def validate_payment(doc, method=None):
@frappe.whitelist()
def get_open_payment_requests_query(doctype, txt, searchfield, start, page_len, filters):
# permission checks in `get_list()`
reference_doctype = filters.get("reference_doctype")
reference_name = filters.get("reference_doctype")
filters = frappe._dict(filters)

if not reference_doctype or not reference_name:
if not filters.reference_doctype or not filters.reference_name:
return []

if txt:
filters.name = ["like", f"%{txt}%"]

open_payment_requests = frappe.get_list(
"Payment Request",
filters={
"reference_doctype": filters["reference_doctype"],
"reference_name": filters["reference_name"],
**filters,
"status": ["!=", "Paid"],
"outstanding_amount": ["!=", 0], # for compatibility with old data
"docstatus": 1,
Expand Down

0 comments on commit 9ce1c25

Please sign in to comment.