Recurring invoice checkbox added in features setup
diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py
index 5858920..01f31eb 100644
--- a/erpnext/accounts/doctype/gl_control/gl_control.py
+++ b/erpnext/accounts/doctype/gl_control/gl_control.py
@@ -507,9 +507,9 @@
 		and notify the concerned people
 	"""	
 	rv = sql("""select name, recurring_id from `tabReceivable Voucher` where ifnull(convert_into_recurring_invoice, 0) = 1 
-			and next_date = %s and next_date <= end_date""", nowdate())
+			and next_date = %s and next_date <= end_date order by next_date	desc""", nowdate())
 	for d in rv:
-		if not sql("""select name from `tabReceivable Voucher` where posting_date = %s and recurring_id = %s""", (nowdate, d[1])):
+		if not sql("""select name from `tabReceivable Voucher` where posting_date = %s and recurring_id = %s""", (nowdate(), d[1])):
 			prev_rv = get_obj('Receivable Voucher', d[0], with_children=1)
 			new_rv = create_new_invoice(prev_rv)
 
@@ -520,6 +520,7 @@
 	new_rv = clone(prev_rv)
 
 	# update new rv 
+
 	new_rv.doc.voucher_date = new_rv.doc.next_date
 	new_rv.doc.posting_date = new_rv.doc.next_date
 	new_rv.doc.aging_date = new_rv.doc.next_date
diff --git a/erpnext/patches/reload_rv.py b/erpnext/patches/reload_rv.py
index b52b111..5f3bc21 100644
--- a/erpnext/patches/reload_rv.py
+++ b/erpnext/patches/reload_rv.py
@@ -1,5 +1,8 @@
 def execute():
 	import webnotes
 	from webnotes.modules.module_manager import reload_doc
+	from webnotes.model.code import get_obj
 
 	reload_doc('accounts', 'doctype', 'receivable_voucher')
+
+	get_obj('Features setup').validate()
diff --git a/erpnext/setup/doctype/features_setup/features_setup.txt b/erpnext/setup/doctype/features_setup/features_setup.txt
index 909882e..d0f02d5 100644
--- a/erpnext/setup/doctype/features_setup/features_setup.txt
+++ b/erpnext/setup/doctype/features_setup/features_setup.txt
@@ -5,14 +5,14 @@
 	{
 		'creation': '2011-09-07 11:59:05',
 		'docstatus': 0,
-		'modified': '2011-10-05 10:50:17',
+		'modified': '2011-12-06 18:48:53',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1317790484',
+		'_last_update': '1323176623',
 		'colour': 'White:FFF',
 		'default_print_format': 'Standard',
 		'doctype': 'DocType',
@@ -22,7 +22,7 @@
 		'name_case': 'Title Case',
 		'section_style': 'Simple',
 		'show_in_menu': 1,
-		'version': 21
+		'version': 24
 	},
 
 	# These values are common for all DocField
@@ -215,6 +215,39 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
+		'label': 'Accounts'
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'description': 'Check if you need automatic recurring invoices. After submitting any sales invoice, Recurring section will be visible.',
+		'doctype': 'DocField',
+		'fieldname': 'fs_recurring_invoice',
+		'fieldtype': 'Check',
+		'label': 'Recurring Invoice'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Column Break'
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'description': 'To enable <b>Point of Sale</b> features',
+		'doctype': 'DocField',
+		'fieldname': 'fs_pos',
+		'fieldtype': 'Check',
+		'label': 'Point of Sale'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Section Break',
 		'label': 'Production'
 	},
 
@@ -246,16 +279,6 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'To enable <b>Point of Sale</b> features',
-		'doctype': 'DocField',
-		'fieldname': 'fs_pos',
-		'fieldtype': 'Check',
-		'label': 'Point of Sale'
-	},
-
-	# DocField
-	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
 		'label': 'Miscelleneous'
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index fcb097b..291265b 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -690,6 +690,9 @@
 	},
 	'fs_pos': {
 		'Receivable Voucher': {'fields':['is_pos']}
+	},
+	'fs_recurring_invoice': {
+		'Receivable Voucher': {'fields': ['Recurring Invoice']}
 	}
 }