Repost sle for si without warehouse
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 8204037..e3437a5 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -94,4 +94,5 @@
 erpnext.patches.v4_2.update_landed_cost_voucher
 erpnext.patches.v4_2.set_item_has_batch
 erpnext.patches.v4_2.update_stock_uom_for_dn_in_sle
-erpnext.patches.v4_2.repost_reserved_qty
\ No newline at end of file
+erpnext.patches.v4_2.repost_reserved_qty
+erpnext.patches.v4_2.repost_sle_for_si_with_no_warehouse
\ No newline at end of file
diff --git a/erpnext/patches/v4_2/repost_sle_for_si_with_no_warehouse.py b/erpnext/patches/v4_2/repost_sle_for_si_with_no_warehouse.py
new file mode 100644
index 0000000..44bec00
--- /dev/null
+++ b/erpnext/patches/v4_2/repost_sle_for_si_with_no_warehouse.py
@@ -0,0 +1,34 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from erpnext.stock.stock_ledger import NegativeStockError
+
+def execute():
+	si_list = frappe.db.sql("""select distinct si.name 
+		from `tabSales Invoice Item` si_item, `tabSales Invoice` si 
+		where si.name = si_item.parent and si.modified > '2015-02-16' and si.docstatus=1 
+		and ifnull(si_item.warehouse, '') = '' and ifnull(si.update_stock, 0) = 1 
+		order by posting_date, posting_time""", as_dict=1)
+		
+	failed_list = []
+	for si in si_list:
+		try:
+			si_doc = frappe.get_doc("Sales Invoice", si.name)		
+			si_doc.docstatus = 2
+			si_doc.on_cancel()
+
+			si_doc.docstatus = 1
+			si_doc.set_missing_item_details()
+			si_doc.on_submit()
+			frappe.db.commit()
+		except:
+			failed_list.append(si.name)
+			frappe.local.stockledger_exceptions = None
+			frappe.db.rollback()
+
+	print "Failed to repost: ", failed_list
+					
+		
+	
\ No newline at end of file