patch to reload_doc and rename field

This commit is contained in:
Zlash65 2018-04-20 09:39:29 +05:30
parent 2e0809801d
commit 540d7aa635
2 changed files with 18 additions and 0 deletions

View File

@ -527,3 +527,4 @@ erpnext.patches.v11_0.rename_field_max_days_allowed
erpnext.patches.v11_0.create_salary_structure_assignments
erpnext.patches.v11_0.rename_health_insurance
erpnext.patches.v11_0.rebuild_tree_for_company
erpnext.patches.v11_0.rename_supplier_type_to_supplier_group

View File

@ -0,0 +1,17 @@
import frappe
from frappe.model.rename_doc import rename_doc
from frappe.model.utils.rename_field import rename_field
def execute():
if frappe.db.table_exists("Supplier Type") and not frappe.db.table_exists("Supplier Group"):
rename_doc("DocType", "Supplier Type", "Supplier Group", force=True)
frappe.reload_doc('setup', 'doctype', 'supplier_group')
frappe.reload_doc("accounts", "doctype", "pricing_rule")
frappe.reload_doc("accounts", "doctype", "tax_rule")
frappe.reload_doc("buying", "doctype", "buying_settings")
frappe.reload_doc("buying", "doctype", "supplier")
rename_field("Supplier Group", "supplier_type", "supplier_group_name")
rename_field("Supplier", "supplier_type", "supplier_group")
rename_field("Buying Settings", "supplier_type", "supplier_group")
rename_field("Pricing Rule", "supplier_type", "supplier_group")
rename_field("Tax Rule", "supplier_type", "supplier_group")