[hotfix] fixed the mysql syntax error issue on stock ledger report (#10442)
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index ec55cec..4a8868a 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -73,7 +73,9 @@
conditions.append("""item_code in (select name from tabItem
{item_conditions})""".format(item_conditions=item_conditions))
if filters.get("warehouse"):
- conditions.append(get_warehouse_condition(filters.get("warehouse")))
+ warehouse_condition = get_warehouse_condition(filters.get("warehouse"))
+ if warehouse_condition:
+ conditions.append(warehouse_condition)
if filters.get("voucher_no"):
conditions.append("voucher_no=%(voucher_no)s")
if filters.get("batch_no"):