diff --git a/erpnext/utilities/page/leaderboard/leaderboard.py b/erpnext/utilities/page/leaderboard/leaderboard.py index 6e7eabc8261..58d480e2b61 100644 --- a/erpnext/utilities/page/leaderboard/leaderboard.py +++ b/erpnext/utilities/page/leaderboard/leaderboard.py @@ -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(