import frappe

def execute():
	for doctype in ('Sales Order', 'Purchase Order', 'Sales Invoice',
		'Purchase Invoice'):
		frappe.reload_doctype(doctype)
		frappe.db.sql('''update `tab{0}` set submit_on_creation=1, notify_by_email=1
			where is_recurring=1'''.format(doctype))
		frappe.db.sql('''update `tab{0}` set notify_by_email=1
			where is_recurring=1'''.format(doctype))
		frappe.db.sql('''update `tab{0}` set recurring_id = name
			where is_recurring=1 and ifnull(recurring_id, '') = "" '''.format(doctype))

@@ -208,129 +208,9 @@
 ion=
-1, notify_by_email=1%0A%09%09%09where is_recurring=1'''.format(doctype))%0A%09%09frappe.db.sql('''update %60tab%7B0%7D%60 set notify_by_email=1
+0
 %0A%09%09%09

Update set_recurring_id.py