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

This commit is contained in:
rohitwaghchaure 2019-12-10 21:34:03 +05:30 committed by Nabin Hait
parent 664d0d89b5
commit c58495dcee
2 changed files with 8 additions and 4 deletions

View File

@ -20,11 +20,15 @@ frappe.query_reports["Item-wise Sales History"] = {
},
{
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",
},

View File

@ -196,6 +196,7 @@ def get_customer_details():
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 @@ def get_sales_order_details(company_list, filters):
`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)