perf: avoid full table scan in sle count check (#36428)

This commit is contained in:
Ankush Menat
2023-07-31 22:13:47 +05:30
committed by GitHub
parent f83a100a8d
commit f31d07554d

View File

@@ -17,7 +17,7 @@ def execute(filters=None):
if not filters:
filters = {}
sle_count = frappe.db.count("Stock Ledger Entry", {"is_cancelled": 0})
sle_count = frappe.db.count("Stock Ledger Entry")
if sle_count > SLE_COUNT_LIMIT and not filters.get("item_code") and not filters.get("warehouse"):
frappe.throw(_("Please select either the Item or Warehouse filter to generate the report."))