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

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

(cherry picked from commit f31d07554d)

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
mergify[bot]
2023-08-01 11:20:26 +05:30
committed by GitHub
parent 782a4d1fa8
commit 04f9915009

View File

@@ -16,7 +16,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."))