Skip to content

Commit

Permalink
fix: payment entry get outstanding documents for advance payments
Browse files Browse the repository at this point in the history
  • Loading branch information
dj12djdjs committed May 28, 2022
1 parent f9f5d8b commit 1ca20b9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ def get_orders_to_be_billed(
if voucher_type:
doc = frappe.get_doc({"doctype": voucher_type})
condition = ""
if doc and hasattr(doc, "cost_center"):
if doc and hasattr(doc, "cost_center") and doc.cost_center is not None:
condition = " and cost_center='%s'" % cost_center

orders = []
Expand Down Expand Up @@ -1452,9 +1452,15 @@ def get_orders_to_be_billed(

order_list = []
for d in orders:
if not (
flt(d.outstanding_amount) >= flt(filters.get("outstanding_amt_greater_than"))
and flt(d.outstanding_amount) <= flt(filters.get("outstanding_amt_less_than"))
if (
filters
and filters.get("outstanding_amt_greater_than")
and filters.get("outstanding_amt_less_than")
and not (
flt(filters.get("outstanding_amt_greater_than"))
<= flt(d.outstanding_amount)
<= flt(filters.get("outstanding_amt_less_than"))
)
):
continue

Expand Down

0 comments on commit 1ca20b9

Please sign in to comment.