Merge pull request #7014 from rohitwaghchaure/rename_autoname_field

patch for rename autoname field
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 5f8531d..30e8e03 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -349,3 +349,4 @@
 erpnext.patches.v7_1.update_invoice_status
 erpnext.patches.v7_0.po_status_issue_for_pr_return
 erpnext.patches.v7_1.update_missing_salary_component_type
+erpnext.patches.v7_0.update_autoname_field
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/update_autoname_field.py b/erpnext/patches/v7_0/update_autoname_field.py
new file mode 100644
index 0000000..bfa9b28
--- /dev/null
+++ b/erpnext/patches/v7_0/update_autoname_field.py
@@ -0,0 +1,14 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	doctypes = frappe.db.sql(""" select name, autoname from `tabDocType`
+		where autoname like 'field:%' and allow_rename = 1""", as_dict=1)
+
+	for doctype in doctypes:
+		fieldname = doctype.autoname.split(":")[1]
+		if fieldname:
+			frappe.db.sql(""" update `tab%s` set %s = name """%(doctype.name, fieldname))
\ No newline at end of file