From 04f99150098c033fe2f27ec92c789bae9209be0e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 1 Aug 2023 11:20:26 +0530 Subject: [PATCH] perf: avoid full table scan in sle count check (#36428) perf: avoid full table scan in sle count check (#36428) (cherry picked from commit f31d07554d05f5b325d8770b90e70e9ee214844b) Co-authored-by: Ankush Menat --- .../batch_wise_balance_history/batch_wise_balance_history.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py index 0f319554763..b38dba8bb17 100644 --- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py +++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py @@ -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."))