diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py
index 585892075fb..01f31eb7ddc 100644
--- a/erpnext/accounts/doctype/gl_control/gl_control.py
+++ b/erpnext/accounts/doctype/gl_control/gl_control.py
@@ -507,9 +507,9 @@ def manage_recurring_invoices():
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 @@ def create_new_invoice(prev_rv):
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 b52b1114b44..5f3bc210ae0 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 909882eed97..d0f02d576d4 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
@@ -211,6 +211,39 @@
'label': 'Sales Extras'
},
+ # DocField
+ {
+ '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 Point of Sale features',
+ 'doctype': 'DocField',
+ 'fieldname': 'fs_pos',
+ 'fieldtype': 'Check',
+ 'label': 'Point of Sale'
+ },
+
# DocField
{
'doctype': 'DocField',
@@ -244,16 +277,6 @@
'label': 'Quality'
},
- # DocField
- {
- 'colour': 'White:FFF',
- 'description': 'To enable Point of Sale features',
- 'doctype': 'DocField',
- 'fieldname': 'fs_pos',
- 'fieldtype': 'Check',
- 'label': 'Point of Sale'
- },
-
# DocField
{
'doctype': 'DocField',
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index fcb097bd4ed..291265b3bd2 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -690,6 +690,9 @@ pscript.feature_dict = {
},
'fs_pos': {
'Receivable Voucher': {'fields':['is_pos']}
+ },
+ 'fs_recurring_invoice': {
+ 'Receivable Voucher': {'fields': ['Recurring Invoice']}
}
}