diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3fffade9bb..a8696fa24b 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -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 diff --git a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py new file mode 100644 index 0000000000..b5b1bf4090 --- /dev/null +++ b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py @@ -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")