fix: do not consider cancelled SLEs in report

This commit is contained in:
Mihir Kandoi
2025-07-17 11:20:05 +05:30
parent 8d091f6821
commit 71578cb2ef

View File

@@ -106,7 +106,10 @@ def get_columns(filters):
def validate_filters(filters):
if not (filters.get("item_code") or filters.get("warehouse")):
sle_count = flt(frappe.qb.from_("Stock Ledger Entry").select(Count("name")).run()[0][0])
table = frappe.qb.DocType("Stock Ledger Entry")
sle_count = flt(
frappe.qb.from_(table).select(Count(table.name)).where(table.is_cancelled == 0).run()[0][0]
)
if sle_count > 500000:
frappe.throw(_("Please set filter based on Item or Warehouse"))