stock repost patch
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index ec327c7..6a7fb01 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -209,6 +209,7 @@
 			if ret['warehouse']:
 				actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], ret['warehouse']))
 				ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
+			msgprint(ret)
 		return ret
 
 	def get_barcode_details(self, barcode):
diff --git a/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py b/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py
index ad6a23a..5900a0a 100644
--- a/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py
+++ b/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py
@@ -8,15 +8,15 @@
 			
 			from `tabDelivery Note Packing Item` dnpi, `tabSales Order Item` so_item, `tabSales Order` so
 			
-			where dnpi.parent = so.name
+			where dnpi.item_code = %s
+			and dnpi.warehouse = %s
+			and dnpi.parent = so.name
 			and so_item.parent = so.name
 			and dnpi.parenttype = 'Sales Order'
 			and dnpi.parent_detail_docname = so_item.name
 			and dnpi.parent_item = so_item.item_code
 			and so.docstatus = 1
 			and so.status != 'Stopped'
-			and dnpi.item_code = %s
-			and dnpi.warehouse = %s
 		""", (d[0], d[1]))
 		if flt(d[3]) != flt(reserved_qty[0][0]):
 			print d[3], reserved_qty[0][0]