From b978c9173d7c0abfbc66d4bc927cd0b4c78bffa6 Mon Sep 17 00:00:00 2001 From: crescent28 <41110073+crescent28@users.noreply.github.com> Date: Mon, 22 Jul 2019 11:13:27 +0530 Subject: [PATCH] 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 --- erpnext/accounts/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index a617de3ba7..e1ed642e73 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -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