fix: Don't fetch already discounted invoice

This commit is contained in:
Nabin Hait 2019-04-18 15:13:18 +05:30
parent 36bb3f55f2
commit 8170585faf

View File

@ -190,9 +190,11 @@ def get_invoices(filters):
customer,
posting_date,
outstanding_amount
from `tabSales Invoice`
from `tabSales Invoice` si
where
docstatus = 1
and outstanding_amount > 0
%s
and not exists(select di.name from `tabDiscounted Invoice` di
where di.docstatus=1 and di.sales_invoice=si.name)
""" % where_condition, filters, as_dict=1)