cancelled sales invoice totals shouldn't be reflected in leaderboard for customer (#12292)

This commit is contained in:
Shreya Shah 2018-01-05 12:45:43 +05:30 committed by Nabin Hait
parent 76ea7a9227
commit 48351e0339

View File

@ -34,7 +34,8 @@ def get_all_customers(doctype, filters, items, field, start=0, limit=20):
x = frappe.get_list(doctype, filters=filters, limit_start=start, limit_page_length=limit)
for val in x:
y = dict(frappe.db.sql('''select name, grand_total from `tabSales Invoice` where customer = %s''', (val.name)))
y = dict(frappe.db.sql('''select name, grand_total from `tabSales Invoice`\
where customer = %s and docstatus != 2''', (val.name)))
invoice_list = y.keys()
if len(invoice_list) > 0:
item_count = frappe.db.sql('''select count(name) from `tabSales Invoice Item` where parent in (%s)''' % ", ".join(