brotherton-erpnext/erpnext/patches/v12_0/move_parameters_to_priority.py

38 lines
1.2 KiB
Python
Raw Normal View History

2019-05-05 07:01:04 +00:00
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
2019-05-06 18:13:16 +00:00
priority = ["Low", "Medium", "High"]
2019-05-05 11:51:38 +00:00
service_levels = frappe.get_list("Service Level")
2019-05-05 07:01:04 +00:00
for service_level in service_levels:
2019-05-05 11:51:38 +00:00
doc = frappe.get_doc("Service Level", service_level)
2019-05-06 18:13:16 +00:00
for value in priority:
doc.append("priorities",
2019-05-05 11:51:38 +00:00
{
2019-05-06 18:13:16 +00:00
"priority": "{0}".format(value),
2019-05-05 18:25:17 +00:00
"response_time": doc.response_time,
"response_time_period": doc.response_time_period,
"resolution_time": doc.resolution_time,
"resolution_time_period": doc.resolution_time_period,
2019-05-05 11:51:38 +00:00
}
2019-05-06 18:13:16 +00:00
)
doc.save(ignore_permissions=True)
2019-05-05 07:01:04 +00:00
2019-05-05 11:51:38 +00:00
service_level_agreements = frappe.get_list("Service Level Agreement")
2019-05-05 07:01:04 +00:00
for service_level_agreement in service_level_agreements:
2019-05-05 11:51:38 +00:00
doc = frappe.get_doc("Service Level Agreement", service_level_agreement)
2019-05-06 18:13:16 +00:00
for value in priority:
doc.append("priorities",
2019-05-05 11:51:38 +00:00
{
2019-05-06 18:13:16 +00:00
"priority": "{0}".format(value),
2019-05-05 18:25:17 +00:00
"response_time": doc.response_time,
"response_time_period": doc.response_time_period,
"resolution_time": doc.resolution_time,
"resolution_time_period": doc.resolution_time_period,
2019-05-06 18:13:16 +00:00
}
)
doc.save(ignore_permissions=True)