[minor][hot] fixes for KeyError: from_date for stock balance report
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index 2db741d..d14dba4 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -63,7 +63,7 @@
frappe.throw(_("'From Date' is required"))
if filters.get("to_date"):
- conditions += " and sle.posting_date <= '%s'" % frappe.db.escape(filters["to_date"])
+ conditions += " and sle.posting_date <= '%s'" % frappe.db.escape(filters.get("to_date"))
else:
frappe.throw(_("'To Date' is required"))
@@ -108,8 +108,8 @@
def get_item_warehouse_map(filters):
iwb_map = {}
- from_date = getdate(filters["from_date"])
- to_date = getdate(filters["to_date"])
+ from_date = getdate(filters.get("from_date"))
+ to_date = getdate(filters.get("to_date"))
sle = get_stock_ledger_entries(filters)
@@ -174,7 +174,7 @@
value = ()
if filters.get("item_code"):
condition = "where item_code=%s"
- value = (filters["item_code"],)
+ value = (filters.get("item_code"),)
items = frappe.db.sql("""select name, item_name, stock_uom, item_group, brand, description
from tabItem {condition}""".format(condition=condition), value, as_dict=1)