From 42b395916dbe35a2bdf2aa2fcdcac7523d19dcef Mon Sep 17 00:00:00 2001 From: Maharshi Patel Date: Tue, 9 Aug 2022 18:22:05 +0530 Subject: [PATCH] fix: f-string and where clause Used f-string formatting and added conditions to WHERE clause --- .../hsn_wise_summary_of_outward_supplies.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py index 8df1046abf1..68815bf1edf 100644 --- a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py +++ b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py @@ -140,7 +140,7 @@ def get_items(filters): match_conditions = " and {0} ".format(match_conditions) items = frappe.db.sql( - """ + f""" SELECT `tabSales Invoice Item`.gst_hsn_code, `tabSales Invoice Item`.stock_uom, @@ -153,10 +153,11 @@ def get_items(filters): FROM `tabSales Invoice` INNER JOIN `tabSales Invoice Item` ON `tabSales Invoice`.name = `tabSales Invoice Item`.parent - INNER JOIN `tabGST HSN Code` ON `tabSales Invoice Item`.gst_hsn_code = `tabGST HSN Code`.name % s % s + INNER JOIN `tabGST HSN Code` ON `tabSales Invoice Item`.gst_hsn_code = `tabGST HSN Code`.name WHERE `tabSales Invoice`.docstatus = 1 AND `tabSales Invoice Item`.gst_hsn_code IS NOT NULL + {conditions} GROUP BY `tabSales Invoice Item`.parent, `tabSales Invoice Item`.item_code, @@ -165,8 +166,9 @@ def get_items(filters): ORDER BY `tabSales Invoice Item`.gst_hsn_code, `tabSales Invoice Item`.uom - """ - % (conditions, match_conditions), + """.format( + conditions=conditions + ), filters, as_dict=1, )