mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-28 11:08:32 +00:00
fix: f-string and where clause
Used f-string formatting and added conditions to WHERE clause
This commit is contained in:
@@ -140,7 +140,7 @@ def get_items(filters):
|
|||||||
match_conditions = " and {0} ".format(match_conditions)
|
match_conditions = " and {0} ".format(match_conditions)
|
||||||
|
|
||||||
items = frappe.db.sql(
|
items = frappe.db.sql(
|
||||||
"""
|
f"""
|
||||||
SELECT
|
SELECT
|
||||||
`tabSales Invoice Item`.gst_hsn_code,
|
`tabSales Invoice Item`.gst_hsn_code,
|
||||||
`tabSales Invoice Item`.stock_uom,
|
`tabSales Invoice Item`.stock_uom,
|
||||||
@@ -153,10 +153,11 @@ def get_items(filters):
|
|||||||
FROM
|
FROM
|
||||||
`tabSales Invoice`
|
`tabSales Invoice`
|
||||||
INNER JOIN `tabSales Invoice Item` ON `tabSales Invoice`.name = `tabSales Invoice Item`.parent
|
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
|
WHERE
|
||||||
`tabSales Invoice`.docstatus = 1
|
`tabSales Invoice`.docstatus = 1
|
||||||
AND `tabSales Invoice Item`.gst_hsn_code IS NOT NULL
|
AND `tabSales Invoice Item`.gst_hsn_code IS NOT NULL
|
||||||
|
{conditions}
|
||||||
GROUP BY
|
GROUP BY
|
||||||
`tabSales Invoice Item`.parent,
|
`tabSales Invoice Item`.parent,
|
||||||
`tabSales Invoice Item`.item_code,
|
`tabSales Invoice Item`.item_code,
|
||||||
@@ -165,8 +166,9 @@ def get_items(filters):
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
`tabSales Invoice Item`.gst_hsn_code,
|
`tabSales Invoice Item`.gst_hsn_code,
|
||||||
`tabSales Invoice Item`.uom
|
`tabSales Invoice Item`.uom
|
||||||
"""
|
""".format(
|
||||||
% (conditions, match_conditions),
|
conditions=conditions
|
||||||
|
),
|
||||||
filters,
|
filters,
|
||||||
as_dict=1,
|
as_dict=1,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user