From ce22d34fcff4443652babb9c0c939d1141b38da8 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 27 Jun 2016 17:04:07 +0530 Subject: [PATCH] [fix] report Stock Projected Qty --- .../stock/report/stock_projected_qty/stock_projected_qty.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py index 409833a939..f90fb49045 100644 --- a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py +++ b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py @@ -66,11 +66,12 @@ def get_bin_list(filters): lft, rgt = frappe.db.get_value("Warehouse", filters.warehouse, ["lft", "rgt"]) conditions.append(" exists (select name from `tabWarehouse` wh \ - where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(lft, rgt)) + where wh.lft >= %s and wh.rgt <= %s and bin.warehouse = wh.name)"%(lft, rgt)) bin_list = frappe.db.sql("""select item_code, warehouse, actual_qty, planned_qty, indented_qty, ordered_qty, reserved_qty, reserved_qty_for_production, projected_qty - from tabBin where %s order by item_code, warehouse """% " and ".join(conditions), as_dict=1,debug=1) + from tabBin bin {conditions} order by item_code, warehouse + """.format(conditions=" where " + " and ".join(conditions) if conditions else ""), as_dict=1) return bin_list