Merge branch 'stable' of github.com:webnotes/erpnext into stable

Conflicts:
	erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index d09331a..b97274f 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -63,7 +63,7 @@
 		return sql("select name from `tabCost Center` where parent_cost_center = %s and docstatus != 2", self.doc.name)
 
 	#-------------------------------------------------------------------------
-	def validate(self): 
+	def validate(self):
 		"""
 			Cost Center name must be unique
 		"""
@@ -89,9 +89,6 @@
 	def on_update(self):
 		self.update_nsm_model()
 		
-	def check_if_child_exists(self):
-		return sql("select name from `tabCost Center` where parent_cost_center = %s and docstatus != 2", self.doc.name)
-		
 	# On Trash
 	#-------------------------------------------------------------------------
 	def on_trash(self):
diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
index 41722d5..ce26865 100644
--- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
+++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
@@ -146,7 +146,6 @@
   $c_obj(make_doclist(dt,dn),'pull_details','',callback);
 }
 
-
 // ========== PV Details Table ============
 
 // Item Code
diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.py b/erpnext/accounts/doctype/payable_voucher/payable_voucher.py
index c4f0bc5..a7e128b 100644
--- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.py
+++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.py
@@ -72,7 +72,7 @@
 				ret['cost_center'] = cost_center and cost_center[0][0] or ''
 		return ret
 		 
-	
+		
 	# Get Items based on PO or PR
 	# ----------------------------
 	def pull_details(self):
diff --git a/erpnext/hr/doctype/appraisal/appraisal.txt b/erpnext/hr/doctype/appraisal/appraisal.txt
index e2abb35..b10c434 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.txt
+++ b/erpnext/hr/doctype/appraisal/appraisal.txt
@@ -386,4 +386,4 @@
 		'oldfieldtype': 'Currency',
 		'permlevel': 1
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/hr/doctype/appraisal_detail/appraisal_detail.txt b/erpnext/hr/doctype/appraisal_detail/appraisal_detail.txt
index 771bf4e..06edc81 100644
--- a/erpnext/hr/doctype/appraisal_detail/appraisal_detail.txt
+++ b/erpnext/hr/doctype/appraisal_detail/appraisal_detail.txt
@@ -106,4 +106,4 @@
 		'oldfieldtype': 'Currency',
 		'permlevel': 1
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/patches/patch.py b/erpnext/patches/patch.py
index 4e32c02..2563915 100644
--- a/erpnext/patches/patch.py
+++ b/erpnext/patches/patch.py
@@ -361,32 +361,6 @@
 	elif patch_no == 370:
 		sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'")
 	elif patch_no == 371:
-		comp = sql("select name from tabCompany where docstatus!=2")
-		fy = sql("select name from `tabFiscal Year` order by year_start_date asc")
-		for c in comp:
-			prev_fy = ''
-			for f in fy:
-				fy_obj = get_obj('Fiscal Year', f[0])
-				fy_obj.doc.past_year = prev_fy
-				fy_obj.doc.company = c[0]
-				fy_obj.doc.save()
-				fy_obj.repost()
-				prev_fy = f[0]
-				sql("commit")
-				sql("start transaction")
-	elif patch_no == 372:
-		sql("update tabDocPerm set amend = 0 where parent = 'Salary Structure'")
-		sql("update tabDocPerm set cancel = 1 where parent = 'Company' and role = 'System Manager'")
-	elif patch_no == 373:
-		if sql("select count(name) from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
-			sql("delete from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
-		if sql("select count(name) from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
-			sql("delete from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
-	elif patch_no == 374:
-		reload_doc('accounts', 'doctype', 'internal_reconciliation')
-		reload_doc('accounts', 'doctype', 'ir_payment_detail')
-		reload_doc('accounts', 'Module Def', 'Accounts')
-	elif patch_no == 375:
 		from webnotes.modules.module_manager import reload_doc
 
 		reload_doc('setup', 'doctype','features_setup')
@@ -402,8 +376,7 @@
 		sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st)
 
 		get_obj('Features Setup', 'Features Setup').doc.save()
-		
-	elif patch_no == 376:
+	elif patch_no == 372:
 		from webnotes.modules.module_manager import reload_doc
 
 		reload_doc('setup', 'doctype','features_setup')
@@ -420,10 +393,10 @@
 		sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st)
 
 		get_obj('Features Setup', 'Features Setup').doc.save()
-	elif patch_no == 377:
+	elif patch_no == 373:
 		sql("delete from `tabDocField` where fieldname = 'item_searial_nos' and parent = 'Features Setup'")
 		sql("delete from `tabDefaultValue` where defkey = 'item_searial_nos' and parent = 'Control Panel'")
-	elif patch_no == 378:
+	elif patch_no == 374:
 		rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null")
 		from webnotes.model.code import get_obj
 		m = get_obj('Features Setup')
@@ -431,15 +404,12 @@
 			m.doc.fields[d[0]] = 1
 		m.doc.save()
 		m.validate()
-	elif patch_no == 379:
-		if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button'")[0][0] > 1:
-			sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button' limit 1")
-	elif patch_no == 380:
+	elif patch_no == 375:
 		from webnotes.session_cache import clear_cache
 		clear_cache(webnotes.session['user'])
-	elif patch_no == 381:
+	elif patch_no == 376:
 		reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
-	elif patch_no == 382:
+	elif patch_no == 377:
 		flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos']
 		
 		st = "'"+"', '".join(flds)+"'"
@@ -448,6 +418,35 @@
 		
 		from webnotes.session_cache import clear_cache
 		clear_cache(webnotes.session['user'])
+	elif patch_no == 378:
+		comp = sql("select name from tabCompany where docstatus!=2")
+		fy = sql("select name from `tabFiscal Year` order by year_start_date asc")
+		for c in comp:
+			prev_fy = ''
+			for f in fy:
+				fy_obj = get_obj('Fiscal Year', f[0])
+				fy_obj.doc.past_year = prev_fy
+				fy_obj.doc.company = c[0]
+				fy_obj.doc.save()
+				fy_obj.repost()
+				prev_fy = f[0]
+				sql("commit")
+				sql("start transaction")
+	elif patch_no == 379:
+		sql("update tabDocPerm set amend = 0 where parent = 'Salary Structure'")
+		sql("update tabDocPerm set cancel = 1 where parent = 'Company' and role = 'System Manager'")
+	elif patch_no == 380:
+		if sql("select count(name) from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
+			sql("delete from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
+		if sql("select count(name) from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
+			sql("delete from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
+	elif patch_no == 381:
+		reload_doc('accounts', 'doctype', 'internal_reconciliation')
+		reload_doc('accounts', 'doctype', 'ir_payment_detail')
+		reload_doc('accounts', 'Module Def', 'Accounts')
+	elif patch_no == 382:
+		if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button'")[0][0] > 1:
+			sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button' limit 1")
 	elif patch_no == 383:
 		reload_doc('accounts', 'doctype', 'cost_center')
 	elif patch_no == 384:
diff --git a/erpnext/selling/doctype/enquiry/enquiry.py b/erpnext/selling/doctype/enquiry/enquiry.py
index 773bedf..5748525 100644
--- a/erpnext/selling/doctype/enquiry/enquiry.py
+++ b/erpnext/selling/doctype/enquiry/enquiry.py
@@ -116,7 +116,6 @@
       ch.person = d
       ch.save(1)
 
-
   #--------------Validation For Last Contact Date-----------------
   # ====================================================================================================================
   def set_last_contact_date(self):
diff --git a/erpnext/setup/doctype/features_setup/features_setup.txt b/erpnext/setup/doctype/features_setup/features_setup.txt
index a7c6fe8..eff542b 100644
--- a/erpnext/setup/doctype/features_setup/features_setup.txt
+++ b/erpnext/setup/doctype/features_setup/features_setup.txt
@@ -319,4 +319,4 @@
 		'fieldtype': 'Check',
 		'label': 'More Info'
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
index 196d028..ec3ff86 100644
--- a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
+++ b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
@@ -210,4 +210,4 @@
 		'to_table': 'Purchase Tax Detail',
 		'validation_logic': 'docstatus = 1'
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index ec73079..aa75b61 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -78,6 +78,7 @@
   locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
 }
 
+
 // Get Purchase Order Button
 // -----------------
 cur_frm.cscript['Pull Purchase Order Details'] = function(doc, dt, dn) {
@@ -89,6 +90,7 @@
 }
 
 
+
 //================ create new contact ============================================================================
 cur_frm.cscript.new_contact = function(){
   tn = createLocal('Contact');