Merge pull request #17073 from nabinhait/stock-report-fix
fix(stock): Fixed stock balance and stock ledger report
This commit is contained in:
commit
04399e6621
@ -225,16 +225,15 @@ def get_item_details(items, sle, filters):
|
||||
cf_join = "left join `tabUOM Conversion Detail` ucd on ucd.parent=item.name and ucd.uom='%s'" \
|
||||
% frappe.db.escape(filters.get("include_uom"))
|
||||
|
||||
item_codes = ', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])
|
||||
res = frappe.db.sql("""
|
||||
select
|
||||
item.name, item.item_name, item.description, item.item_group, item.brand, item.stock_uom {cf_field}
|
||||
item.name, item.item_name, item.description, item.item_group, item.brand, item.stock_uom %s
|
||||
from
|
||||
`tabItem` item
|
||||
{cf_join}
|
||||
%s
|
||||
where
|
||||
item.name in ({item_codes}) and ifnull(item.disabled, 0) = 0
|
||||
""".format(cf_field=cf_field, cf_join=cf_join, item_codes=item_codes), as_dict=1)
|
||||
item.name in (%s) and ifnull(item.disabled, 0) = 0
|
||||
""" % (cf_field, cf_join, ','.join(['%s'] *len(items))), items, as_dict=1)
|
||||
|
||||
for item in res:
|
||||
item_details.setdefault(item.name, item)
|
||||
|
@ -113,7 +113,6 @@ def get_item_details(items, sl_entries, include_uom):
|
||||
cf_join = "left join `tabUOM Conversion Detail` ucd on ucd.parent=item.name and ucd.uom='%s'" \
|
||||
% frappe.db.escape(include_uom)
|
||||
|
||||
item_codes = ', '.join([frappe.db.escape(i, percent=False) for i in items])
|
||||
res = frappe.db.sql("""
|
||||
select
|
||||
item.name, item.item_name, item.description, item.item_group, item.brand, item.stock_uom {cf_field}
|
||||
@ -122,7 +121,7 @@ def get_item_details(items, sl_entries, include_uom):
|
||||
{cf_join}
|
||||
where
|
||||
item.name in ({item_codes})
|
||||
""".format(cf_field=cf_field, cf_join=cf_join, item_codes=item_codes), as_dict=1)
|
||||
""".format(cf_field=cf_field, cf_join=cf_join, item_codes=','.join(['%s'] *len(items))), items, as_dict=1)
|
||||
|
||||
for item in res:
|
||||
item_details.setdefault(item.name, item)
|
||||
|
Loading…
x
Reference in New Issue
Block a user