diff --git a/erpnext/patches/v15_0/rename_sla_fields.py b/erpnext/patches/v15_0/rename_sla_fields.py index 5e3e92d85c2..e5e69e0921e 100644 --- a/erpnext/patches/v15_0/rename_sla_fields.py +++ b/erpnext/patches/v15_0/rename_sla_fields.py @@ -6,8 +6,14 @@ from frappe.model.utils.rename_field import rename_field def execute(): doctypes = frappe.get_all("Service Level Agreement", pluck="document_type") for doctype in doctypes: - rename_fieldname(doctype + "-resolution_by", "sla_resolution_by") - rename_fieldname(doctype + "-resolution_date", "sla_resolution_date") + if doctype == "Issue": + continue + + if frappe.db.exists("Custom Field", {"fieldname": doctype + "-resolution_by"}): + rename_fieldname(doctype + "-resolution_by", "sla_resolution_by") + + if frappe.db.exists("Custom Field", {"fieldname": doctype + "-resolution_date"}): + rename_fieldname(doctype + "-resolution_date", "sla_resolution_date") rename_field("Issue", "resolution_by", "sla_resolution_by") rename_field("Issue", "resolution_date", "sla_resolution_date")