Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/README.md b/README.md
index 27f86fe..4ed8f0d 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@
 To update from wnframework version 1.
 
 1. set your html folder to the root of erpnext (rather than wnframework)
-2. symlink wnframework as 'lib':
+2. create a symlink in erpnext:
 
     ln -s path/to/wnframework lib
 
@@ -35,6 +35,11 @@
 
     python lib/wnf.py setup
 
+4. copy defs.py from cgi-bin/webnotes to py/webnotes
+5. change module_path (point to erpnext/erpnext) in defs.py
+6. delete cgi-bin directory
+7. delete all old module directories from erpnext
+
 ## License
 
 ERPNext is available under the GNU/GPL license.
diff --git a/erpnext/patches/patch.py b/erpnext/patches/patch.py
index 8ced1a3..e930c2e 100644
--- a/erpnext/patches/patch.py
+++ b/erpnext/patches/patch.py
@@ -1,7 +1,7 @@
 # REMEMBER to update this
 # ========================
 
-last_patch = 365
+last_patch = 366
 
 #-------------------------------------------
 
@@ -308,7 +308,7 @@
 		sql("update tabDocField set label='Produced Qty',description='Updated after finished goods are transferred to FG Warehouse through Stock Entry' where parent='Production Order' and fieldname='produced_qty'")
 		rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null")
 		from webnotes.model.doc import Document
-		m = Document('Features Setup', 'Features Setup')
+		m = Document('Features Setup')
 		for d in rs:
 			m.fields[d[0]] = 1
 		m.save()
@@ -340,3 +340,9 @@
 	elif patch_no == 365:
 		from patches.delivery_billing_status_patch import run_patch
 		run_patch()
+	elif patch_no == 366:
+		bin = sql("select name from tabBin")
+		for b in bin:
+			bobj = get_obj('Bin',b[0])
+			prev_sle = bobj.get_prev_sle(posting_date = '2011-09-15', posting_time = '01:00')
+			bobj.update_item_valuation(posting_date = '2011-09-15', posting_time = '01:00', prev_sle = prev_sle)
diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py
index 3b71bd0..cf9509a 100644
--- a/erpnext/stock/doctype/bin/bin.py
+++ b/erpnext/stock/doctype/bin/bin.py
@@ -40,9 +40,10 @@
 			
 		
 		# update valuation for post dated entry
-		if actual_qty and serial_no:
+		if actual_qty:
 			# check actual qty with total number of serial no
-			self.check_qty_with_serial_no()
+			if serial_no:
+				self.check_qty_with_serial_no()
 			
 			prev_sle = self.get_prev_sle(dt, posting_time, sle_id)
 			cqty = flt(prev_sle.get('bin_aqat', 0))