Rename table fieldnames only if doctype exists

This commit is contained in:
Nabin Hait 2015-05-11 15:11:08 +05:30
parent affb3ec220
commit fedcb242ef

View File

@ -227,12 +227,13 @@ def execute():
frappe.reload_doc("accounts", "doctype", "fiscal_year_company") frappe.reload_doc("accounts", "doctype", "fiscal_year_company")
#rename table fieldnames #rename table fieldnames
for dn in rename_map: if frappe.db.exists("DocType", dn):
frappe.reload_doc(get_doctype_module(dn), "doctype", scrub(dn)) for dn in rename_map:
frappe.reload_doc(get_doctype_module(dn), "doctype", scrub(dn))
for dt, field_list in rename_map.items(): for dt, field_list in rename_map.items():
for field in field_list: for field in field_list:
rename_field(dt, field[0], field[1]) rename_field(dt, field[0], field[1])
# update voucher type # update voucher type
for old, new in [["Bank Voucher", "Bank Entry"], ["Cash Voucher", "Cash Entry"], for old, new in [["Bank Voucher", "Bank Entry"], ["Cash Voucher", "Cash Entry"],