patch: try catch to handle TableMissingError
This commit is contained in:
parent
c86954ce9b
commit
36d6e570c4
@ -25,40 +25,46 @@ def set_priority_for_issue():
|
|||||||
frappe.db.set_value("Issue", issue.name, "priority", issue.priority)
|
frappe.db.set_value("Issue", issue.name, "priority", issue.priority)
|
||||||
|
|
||||||
def set_priorities_service_level():
|
def set_priorities_service_level():
|
||||||
service_level_priorities = frappe.get_list("Service Level", fields=["name", "priority", "response_time", "response_time_period", "resolution_time", "resolution_time_period"], debug=True)
|
try:
|
||||||
print(service_level_priorities)
|
service_level_priorities = frappe.get_list("Service Level", fields=["name", "priority", "response_time", "response_time_period", "resolution_time", "resolution_time_period"])
|
||||||
frappe.reload_doc("support", "doctype", "service_level")
|
|
||||||
|
|
||||||
for service_level in service_level_priorities:
|
frappe.reload_doc("support", "doctype", "service_level")
|
||||||
doc = frappe.get_doc("Service Level", service_level.name)
|
|
||||||
doc.append("priorities", {
|
for service_level in service_level_priorities:
|
||||||
"priority": service_level.priority,
|
doc = frappe.get_doc("Service Level", service_level.name)
|
||||||
"default_priority": 1,
|
doc.append("priorities", {
|
||||||
"response_time": service_level.response_time,
|
"priority": service_level.priority,
|
||||||
"response_time_period": service_level.response_time_period,
|
"default_priority": 1,
|
||||||
"resolution_time": service_level.resolution_time,
|
"response_time": service_level.response_time,
|
||||||
"resolution_time_period": service_level.resolution_time_period
|
"response_time_period": service_level.response_time_period,
|
||||||
})
|
"resolution_time": service_level.resolution_time,
|
||||||
doc.save(ignore_permissions=True)
|
"resolution_time_period": service_level.resolution_time_period
|
||||||
|
})
|
||||||
|
doc.save(ignore_permissions=True)
|
||||||
|
except frappe.db.TableMissingError:
|
||||||
|
frappe.reload_doc("support", "doctype", "service_level")
|
||||||
|
|
||||||
def set_priorities_service_level_agreement():
|
def set_priorities_service_level_agreement():
|
||||||
service_level_agreement_priorities = frappe.get_list("Service Level Agreement", fields=["name", "priority", "response_time", "response_time_period", "resolution_time", "resolution_time_period"], debug=True)
|
try:
|
||||||
print(service_level_agreement_priorities)
|
service_level_agreement_priorities = frappe.get_list("Service Level Agreement", fields=["name", "priority", "response_time", "response_time_period", "resolution_time", "resolution_time_period"])
|
||||||
frappe.reload_doc("support", "doctype", "service_level_agreement")
|
|
||||||
|
|
||||||
for service_level_agreement in service_level_agreement_priorities:
|
frappe.reload_doc("support", "doctype", "service_level_agreement")
|
||||||
doc = frappe.get_doc("Service Level Agreement", service_level_agreement.name)
|
|
||||||
|
|
||||||
if doc.customer:
|
for service_level_agreement in service_level_agreement_priorities:
|
||||||
doc.apply_to = "Customer"
|
doc = frappe.get_doc("Service Level Agreement", service_level_agreement.name)
|
||||||
doc.entity = doc.customer
|
|
||||||
|
|
||||||
doc.append("priorities", {
|
if doc.customer:
|
||||||
"priority": service_level_agreement.priority,
|
doc.apply_to = "Customer"
|
||||||
"default_priority": 1,
|
doc.entity = doc.customer
|
||||||
"response_time": service_level_agreement.response_time,
|
|
||||||
"response_time_period": service_level_agreement.response_time_period,
|
doc.append("priorities", {
|
||||||
"resolution_time": service_level_agreement.resolution_time,
|
"priority": service_level_agreement.priority,
|
||||||
"resolution_time_period": service_level_agreement.resolution_time_period
|
"default_priority": 1,
|
||||||
})
|
"response_time": service_level_agreement.response_time,
|
||||||
doc.save(ignore_permissions=True)
|
"response_time_period": service_level_agreement.response_time_period,
|
||||||
|
"resolution_time": service_level_agreement.resolution_time,
|
||||||
|
"resolution_time_period": service_level_agreement.resolution_time_period
|
||||||
|
})
|
||||||
|
doc.save(ignore_permissions=True)
|
||||||
|
except frappe.db.TableMissingError:
|
||||||
|
frappe.reload_doc("support", "doctype", "service_level_agreement")
|
Loading…
x
Reference in New Issue
Block a user