Skip to content

Commit

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

refactor: better date filters in `Get Outstanding Invoices` dialog (backport #37127)
  • Loading branch information
ruthra-kumar authored Sep 18, 2023
2 parents c41cb39 + 4b700b7 commit 8ef548f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,14 @@ def get_outstanding_reference_documents(args):
fieldname, args.get(date_fields[0]), args.get(date_fields[1])
)
posting_and_due_date.append(ple[fieldname][args.get(date_fields[0]) : args.get(date_fields[1])])
elif args.get(date_fields[0]):
# if only from date is supplied
condition += " and {0} >= '{1}'".format(fieldname, args.get(date_fields[0]))
posting_and_due_date.append(ple[fieldname].gte(args.get(date_fields[0])))
elif args.get(date_fields[1]):
# if only to date is supplied
condition += " and {0} <= '{1}'".format(fieldname, args.get(date_fields[1]))
posting_and_due_date.append(ple[fieldname].lte(args.get(date_fields[1])))

if args.get("company"):
condition += " and company = {0}".format(frappe.db.escape(args.get("company")))
Expand Down

0 comments on commit 8ef548f

Please sign in to comment.