patch: get priority before reload_doc
diff --git a/erpnext/patches/v12_0/set_priority_for_support.py b/erpnext/patches/v12_0/set_priority_for_support.py
index 2c84e59..cde211b 100644
--- a/erpnext/patches/v12_0/set_priority_for_support.py
+++ b/erpnext/patches/v12_0/set_priority_for_support.py
@@ -12,16 +12,22 @@
"name": priority
}).insert(ignore_permissions=True)
+ issue_priority = frappe.get_list("Issue", fields=["name", "priority"])
+
+ service_level_priority = frappe.get_list("Service Level", fields=["name", "priority", "response_time", "response_time_period",
+ "resolution_time", "resolution_time_period"])
+
+ service_level_agreement_priority = frappe.get_list("Service Level Agreement", fields=["name", "priority", "response_time", "response_time_period",
+ "resolution_time", "resolution_time_period"])
+
frappe.reload_doc("support", "doctype", "issue")
frappe.reload_doc("support", "doctype", "service_level")
frappe.reload_doc("support", "doctype", "service_level_agreement")
- for issue in frappe.get_list("Issue", fields=["name", "priority"]):
+ for issue in issue_priority:
frappe.db.set_value("Issue", issue.name, "priority", issue.priority)
- for service_level in frappe.get_list("Service Level", fields=["name", "priority", "response_time", "response_time_period",
- "resolution_time", "resolution_time_period"]):
-
+ for service_level in service_level_priority:
doc = frappe.get_doc("Service Level", service_level.name)
doc.append("priorities", {
"priority": service_level.priority,
@@ -33,8 +39,7 @@
})
doc.save(ignore_permissions=True)
- for service_level_agreement in frappe.get_list("Service Level Agreement", fields=["name", "priority", "response_time", "response_time_period",
- "resolution_time", "resolution_time_period"]):
+ for service_level_agreement in service_level_agreement_priority:
doc = frappe.get_doc("Service Level Agreement", service_level_agreement.name)