From 5b45bcf5f35a3bf23c2f29e922a69c681484cab4 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 11 Jan 2018 12:39:09 +0530 Subject: [PATCH] [Fix] Report Available Stock for Packing Items Menu not working (#12400) --- .../available_stock_for_packing_items.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py index 40ed20c93d..1e45a73673 100644 --- a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py +++ b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py @@ -41,8 +41,9 @@ def get_columns(): def get_product_bundle_items(): sbom_item_map = {} - for sbom in frappe.db.sql("""select parent, item_code, qty from `tabProduct Bundle Item` - where docstatus < 2""", as_dict=1): + for sbom in frappe.db.sql("""select pb.new_item_code as parent, pbi.item_code, pbi.qty + from `tabProduct Bundle Item` as pbi, `tabProduct Bundle` as pb + where pb.docstatus < 2 and pb.name = pbi.parent""", as_dict=1): sbom_item_map.setdefault(sbom.parent, {}).setdefault(sbom.item_code, sbom.qty) return sbom_item_map