fix: added null check for filters (#18416)

filters when None, at `filters.get("outstanding_amt_greater_than")` would result in an Attribute Error. This PR just adds a simple null-check in the if conditions. I'm awesome! 

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
This commit is contained in:
crescent28 2019-07-22 11:13:27 +05:30 committed by Nabin Hait
parent 83cba247a7
commit b978c9173d

View File

@ -690,7 +690,7 @@ def get_outstanding_invoices(party_type, party, account, condition=None, filters
payment_amount = pe_map.get((d.voucher_type, d.voucher_no), 0)
outstanding_amount = flt(d.invoice_amount - payment_amount, precision)
if outstanding_amount > 0.5 / (10**precision):
if (filters.get("outstanding_amt_greater_than") and
if (filters and filters.get("outstanding_amt_greater_than") and
not (outstanding_amount >= filters.get("outstanding_amt_greater_than") and
outstanding_amount <= filters.get("outstanding_amt_less_than"))):
continue