Merge pull request #7014 from rohitwaghchaure/rename_autoname_field
patch for rename autoname field
This commit is contained in:
commit
376e8945f7
@ -349,3 +349,4 @@ erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table
|
||||
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
|
14
erpnext/patches/v7_0/update_autoname_field.py
Normal file
14
erpnext/patches/v7_0/update_autoname_field.py
Normal file
@ -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))
|
Loading…
x
Reference in New Issue
Block a user