fix: Item-wise Sales History report not working (#19889)

diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js
index ee806a7..daca2e3 100644
--- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js
+++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js
@@ -20,11 +20,15 @@
 		},
 		{
 			fieldname:"from_date",
+			reqd: 1,
 			label: __("From Date"),
 			fieldtype: "Date",
+			default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
 		},
 		{
 			fieldname:"to_date",
+			reqd: 1,
+			default: frappe.datetime.get_today(),
 			label: __("To Date"),
 			fieldtype: "Date",
 		},
diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py
index 226c34f..1fc3663 100644
--- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py
+++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py
@@ -196,6 +196,7 @@
 
 def get_sales_order_details(company_list, filters):
 	conditions = get_conditions(filters)
+
 	return frappe.db.sql("""
 		SELECT
 			so_item.item_code, so_item.item_name, so_item.item_group,
@@ -208,7 +209,6 @@
 			`tabSales Order` so, `tabSales Order Item` so_item
 		WHERE
 			so.name = so_item.parent
-			AND so.company in (%s)
-			AND so.docstatus = 1
-			{0}
-	""".format(conditions), company_list, as_dict=1) #nosec
+			AND so.company in ({0})
+			AND so.docstatus = 1 {1}
+	""".format(','.join(["%s"] * len(company_list)), conditions), tuple(company_list), as_dict=1)