fix: rename sla fields patch (#46465)

* fix: rename sla fields patch

* fix: rerun patch
This commit is contained in:
Mihir Kandoi
2025-03-12 10:34:20 +05:30
committed by GitHub
parent 6f010915fe
commit 8bce42e633
2 changed files with 8 additions and 4 deletions

View File

@@ -4,15 +4,19 @@ from frappe.model.utils.rename_field import rename_field
def execute():
doctypes = list(set(frappe.get_all("Service Level Agreement", pluck="document_type")))
doctypes = frappe.get_all("Service Level Agreement", pluck="document_type", distinct=True)
for doctype in doctypes:
if doctype == "Issue":
continue
if frappe.db.exists("Custom Field", {"name": doctype + "-resolution_by"}):
if frappe.db.exists(
"Custom Field", {"name": doctype + "-resolution_by", "fieldname": "resolution_by"}
):
rename_fieldname(doctype + "-resolution_by", "sla_resolution_by")
if frappe.db.exists("Custom Field", {"name": doctype + "-resolution_date"}):
if frappe.db.exists(
"Custom Field", {"name": doctype + "-resolution_date", "fieldname": "resolution_date"}
):
rename_fieldname(doctype + "-resolution_date", "sla_resolution_date")
rename_field("Issue", "resolution_by", "sla_resolution_by")