fix: test cases for sla
This commit is contained in:
parent
fbb7ea4856
commit
f8b9c849a1
@ -11,7 +11,7 @@ def execute():
|
||||
for service_level in service_levels:
|
||||
doc = frappe.get_doc("Service Level", service_level)
|
||||
doc.update({
|
||||
"priority": [
|
||||
"priorities": [
|
||||
{
|
||||
"priority": "Low",
|
||||
"response_time": service_level.response_time,
|
||||
@ -40,7 +40,7 @@ def execute():
|
||||
for service_level_agreement in service_level_agreements:
|
||||
doc = frappe.get_doc("Service Level Agreement", service_level_agreement)
|
||||
doc.update({
|
||||
"priority": [
|
||||
"priorities": [
|
||||
{
|
||||
"priority": "Low",
|
||||
"response_time": service_level_agreement.response_time,
|
||||
|
@ -68,6 +68,6 @@ def make_issue(creation=None, customer=None):
|
||||
"customer": customer,
|
||||
"raised_by": "test@example.com",
|
||||
"creation": creation
|
||||
}).insert()
|
||||
}).insert(ignore_permissions=True)
|
||||
|
||||
return issue
|
@ -1,203 +1,53 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2019-03-04 12:55:36.403035",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"workday",
|
||||
"section_break_2",
|
||||
"start_time",
|
||||
"column_break_3",
|
||||
"end_time"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "workday",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Workday",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Monday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\nSunday",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"options": "Monday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\nSunday"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_2",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "start_time",
|
||||
"fieldtype": "Time",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Start Time",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"label": "Start Time"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "end_time",
|
||||
"fieldtype": "Time",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "End Time",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"label": "End Time"
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-03-04 12:55:36.403035",
|
||||
"modified": "2019-05-05 19:15:08.999579",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Service Day",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
"track_changes": 1
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
"column_break_2",
|
||||
"holiday_list",
|
||||
"response_and_resoution_time",
|
||||
"priority",
|
||||
"priorities",
|
||||
"section_break_01",
|
||||
"support_and_resolution"
|
||||
],
|
||||
@ -60,14 +60,14 @@
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "priority",
|
||||
"fieldname": "priorities",
|
||||
"fieldtype": "Table",
|
||||
"label": "Priority",
|
||||
"label": "Priorities",
|
||||
"options": "Service Level Priority",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"modified": "2019-05-04 13:08:33.381734",
|
||||
"modified": "2019-05-05 19:29:56.975951",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Service Level",
|
||||
|
@ -17,12 +17,14 @@ class ServiceLevel(Document):
|
||||
|
||||
def check_priorities(self):
|
||||
priorities = []
|
||||
for priority in self.priority:
|
||||
priorities.append(priority.priority)
|
||||
|
||||
for priority in self.priorities:
|
||||
# Check if response and resolution time is set for every priority
|
||||
if not (priority.response_time or priority.resolution_time):
|
||||
frappe.throw(_("Set Response Time and Resolution for Priority {0} at index {1}.".format(priority.priority, priority.idx)))
|
||||
|
||||
priorities.append(priority.priority)
|
||||
|
||||
if priority.response_time_period == "Hour":
|
||||
response = priority.response_time * 0.0416667
|
||||
elif priority.response_time_period == "Day":
|
||||
@ -40,32 +42,39 @@ class ServiceLevel(Document):
|
||||
if response > resolution:
|
||||
frappe.throw(_("Response Time for {0} at index {1} can't be greater than Resolution Time.".format(priority.priority, priority.idx)))
|
||||
|
||||
# Check if repeated priority
|
||||
if not len(set(priorities)) == len(priorities):
|
||||
repeated_priority = get_repeated(priorities)
|
||||
frappe.throw(_("Priority {0} has been repeated twice.".format(repeated_priority)))
|
||||
frappe.throw(_("Priority {0} has been repeated.".format(repeated_priority)))
|
||||
|
||||
# Check if values for all the priority options is set
|
||||
priority_count = ([field.options for field in frappe.get_meta("Service Level Priority").fields if field.fieldname=='priority'][0]).split("\n")
|
||||
if not len(set(priorities)) == len(priority_count):
|
||||
frappe.throw(_("Set values for all the Priorities."))
|
||||
frappe.throw(_("Set values for all the Priorities {0}.".format(" ".join(priority_count))))
|
||||
|
||||
def check_support_and_resolution(self):
|
||||
week = get_weekdays()
|
||||
indexes = []
|
||||
support_days = []
|
||||
|
||||
for support_and_resolution in self.support_and_resolution:
|
||||
indexes.append(week.index(support_and_resolution.workday))
|
||||
# Check if start and end time is set for every support day
|
||||
if not (support_and_resolution.start_time or support_and_resolution.end_time):
|
||||
frappe.throw(_("Set Start Time and End Time for \
|
||||
Support Day {0} at index {1}.".format(support_and_resolution.workday, support_and_resolution.idx)))
|
||||
|
||||
support_days.append(support_and_resolution.workday)
|
||||
support_and_resolution.idx = week.index(support_and_resolution.workday) + 1
|
||||
|
||||
start_time, end_time = (datetime.strptime(support_and_resolution.start_time, '%H:%M:%S').time(),
|
||||
datetime.strptime(support_and_resolution.end_time, '%H:%M:%S').time())
|
||||
if start_time > end_time:
|
||||
frappe.throw(_("Start Time can't be greater than End Time for {0}.".format(support_and_resolution.workday)))
|
||||
if start_time >= end_time:
|
||||
frappe.throw(_("Start Time can't be greater than or equal to End Time \
|
||||
for {0}.".format(support_and_resolution.workday)))
|
||||
|
||||
if not len(set(indexes)) == len(indexes):
|
||||
# Check for repeated workday
|
||||
if not len(set(support_days)) == len(support_days):
|
||||
repeated_days = get_repeated(support_days)
|
||||
frappe.throw(_("Workday {0} has been repeated twice".format(repeated_days)))
|
||||
frappe.throw(_("Workday {0} has been repeated.".format(repeated_days)))
|
||||
|
||||
def get_service_level_priority(self, priority):
|
||||
priority = frappe.get_doc("Service Level Priority", {"priority": priority, "parent": self.name})
|
||||
@ -75,7 +84,7 @@ class ServiceLevel(Document):
|
||||
"response_time": priority.response_time,
|
||||
"response_time_period": priority.response_time_period,
|
||||
"resolution_time": priority.resolution_time,
|
||||
"response_time_period": priority.resolution_time_period
|
||||
"resolution_time_period": priority.resolution_time_period
|
||||
})
|
||||
|
||||
def get_repeated(values):
|
||||
@ -85,5 +94,6 @@ def get_repeated(values):
|
||||
if value not in unique_list:
|
||||
unique_list.append(value)
|
||||
else:
|
||||
diff.append(value)
|
||||
if value not in diff:
|
||||
diff.append(value)
|
||||
return " ".join(diff)
|
||||
|
@ -22,12 +22,30 @@ def make_service_level():
|
||||
"doctype": "Service Level",
|
||||
"service_level": "__Test Service Level",
|
||||
"holiday_list": "__Test Holiday List",
|
||||
"priority": "Medium",
|
||||
"employee_group": employee_group,
|
||||
"response_time": 4,
|
||||
"response_time_period": "Hour",
|
||||
"resolution_time": 6,
|
||||
"resolution_time_period": "Hour",
|
||||
"priorities": [
|
||||
{
|
||||
"priority": "Low",
|
||||
"response_time": 4,
|
||||
"response_time_period": "Hour",
|
||||
"resolution_time": 6,
|
||||
"resolution_time_period": "Hour",
|
||||
},
|
||||
{
|
||||
"priority": "Medium",
|
||||
"response_time": 4,
|
||||
"response_time_period": "Hour",
|
||||
"resolution_time": 6,
|
||||
"resolution_time_period": "Hour",
|
||||
},
|
||||
{
|
||||
"priority": "High",
|
||||
"response_time": 4,
|
||||
"response_time_period": "Hour",
|
||||
"resolution_time": 6,
|
||||
"resolution_time_period": "Hour",
|
||||
}
|
||||
],
|
||||
"support_and_resolution": [
|
||||
{
|
||||
"workday": "Monday",
|
||||
@ -75,12 +93,30 @@ def make_service_level():
|
||||
"doctype": "Service Level",
|
||||
"service_level": "_Test Service Level",
|
||||
"holiday_list": "__Test Holiday List",
|
||||
"priority": "Medium",
|
||||
"employee_group": employee_group,
|
||||
"response_time": 2,
|
||||
"response_time_period": "Day",
|
||||
"resolution_time": 3,
|
||||
"resolution_time_period": "Day",
|
||||
"priorities": [
|
||||
{
|
||||
"priority": "Low",
|
||||
"response_time": 2,
|
||||
"response_time_period": "Day",
|
||||
"resolution_time": 3,
|
||||
"resolution_time_period": "Day",
|
||||
},
|
||||
{
|
||||
"priority": "Medium",
|
||||
"response_time": 2,
|
||||
"response_time_period": "Day",
|
||||
"resolution_time": 3,
|
||||
"resolution_time_period": "Day",
|
||||
},
|
||||
{
|
||||
"priority": "High",
|
||||
"response_time": 2,
|
||||
"response_time_period": "Day",
|
||||
"resolution_time": 3,
|
||||
"resolution_time_period": "Day",
|
||||
}
|
||||
],
|
||||
"support_and_resolution": [
|
||||
{
|
||||
"workday": "Monday",
|
||||
|
@ -11,9 +11,8 @@ frappe.ui.form.on('Service Level Agreement', {
|
||||
name: frm.doc.service_level
|
||||
},
|
||||
callback: function(data){
|
||||
console.log(data);
|
||||
for (var i in data.message.priority){
|
||||
frm.add_child("priority", data.message.priority[i]);
|
||||
for (var i in data.message.priorities){
|
||||
frm.add_child("priorities", data.message.priorities[i]);
|
||||
}
|
||||
for (var i in data.message.support_and_resolution){
|
||||
frm.add_child("support_and_resolution", data.message.support_and_resolution[i]);
|
||||
@ -24,23 +23,11 @@ frappe.ui.form.on('Service Level Agreement', {
|
||||
},
|
||||
|
||||
validate: function(frm) {
|
||||
frm.doc.service_level_agreement_name = null;
|
||||
frm.doc.sla_name = null;
|
||||
var sla_name = 'Default Service Level Agreement';
|
||||
if (frm.doc.customer){
|
||||
sla_name = frm.doc.customer;
|
||||
}
|
||||
frm.doc.service_level_agreement_name = sla_name;
|
||||
frm.doc.sla_name = sla_name;
|
||||
},
|
||||
|
||||
priority: function(frm) {
|
||||
if (!frm.doc.__is_local) {
|
||||
frappe.call({
|
||||
"method": "erpnext.support.service_level_agreement.service_level_agreement.get_active_service_level_agreement_for",
|
||||
"args": {
|
||||
"customer": frm.doc.customer,
|
||||
"priority": frm.doc.priority
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"autoname": "field:service_level_agreement_name",
|
||||
"autoname": "field:sla_name",
|
||||
"creation": "2018-12-26 21:08:15.448812",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"service_level_agreement_name",
|
||||
"sla_name",
|
||||
"customer",
|
||||
"default_service_level_agreement",
|
||||
"holiday_list",
|
||||
@ -18,7 +18,7 @@
|
||||
"column_break_7",
|
||||
"end_date",
|
||||
"response_and_resolution_time_section",
|
||||
"priority",
|
||||
"priorities",
|
||||
"support_and_resolution_section_break",
|
||||
"support_and_resolution"
|
||||
],
|
||||
@ -61,12 +61,6 @@
|
||||
"fieldname": "column_break_2",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "priority",
|
||||
"fieldtype": "Table",
|
||||
"label": "Priority",
|
||||
"options": "Service Level Priority"
|
||||
},
|
||||
{
|
||||
"fetch_from": "service_level.employee_group",
|
||||
"fieldname": "employee_group",
|
||||
@ -126,14 +120,20 @@
|
||||
"options": "Service Day"
|
||||
},
|
||||
{
|
||||
"fieldname": "service_level_agreement_name",
|
||||
"fieldname": "priorities",
|
||||
"fieldtype": "Table",
|
||||
"label": "Priorities",
|
||||
"options": "Service Level Priority"
|
||||
},
|
||||
{
|
||||
"fieldname": "sla_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Service Level Agreement Name",
|
||||
"read_only": 1,
|
||||
"unique": 1
|
||||
}
|
||||
],
|
||||
"modified": "2019-05-05 12:17:02.793287",
|
||||
"modified": "2019-05-05 20:24:57.557178",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Service Level Agreement",
|
||||
|
@ -19,8 +19,10 @@ class ServiceLevelAgreement(Document):
|
||||
else:
|
||||
if not (self.start_date and self.end_date):
|
||||
frappe.throw(_("Enter Start and End Date for the Agreement."))
|
||||
|
||||
if self.start_date >= self.end_date:
|
||||
frappe.throw(_("Start Date of Agreement can't be greater than or equal to End Date."))
|
||||
|
||||
if self.end_date < frappe.utils.getdate():
|
||||
frappe.throw(_("End Date of Agreement can't be less than today."))
|
||||
|
||||
@ -54,8 +56,6 @@ def get_active_service_level_agreement_for(customer, priority):
|
||||
`tabService Level Agreement`.default_service_level_agreement='1'
|
||||
)
|
||||
limit 1
|
||||
""".format(customer, priority), as_dict=True, debug=True)
|
||||
|
||||
print(agreement)
|
||||
""".format(customer, priority), as_dict=True)
|
||||
|
||||
return agreement[0] if agreement else None
|
@ -16,18 +16,36 @@ def make_service_level_agreement():
|
||||
# Default Service Level Agreement
|
||||
default_service_level_agreement = frappe.get_doc({
|
||||
"doctype": "Service Level Agreement",
|
||||
"name": "__Test Service Level Agreement",
|
||||
"sla_name": "Default Service Level Agreement",
|
||||
"default_service_level_agreement": 1,
|
||||
"service_level": "__Test Service Level",
|
||||
"holiday_list": "__Test Holiday List",
|
||||
"priority": "Medium",
|
||||
"employee_group": "_Test Employee Group",
|
||||
"start_date": frappe.utils.getdate(),
|
||||
"end_date": frappe.utils.add_to_date(frappe.utils.getdate(), days=100),
|
||||
"response_time": 4,
|
||||
"response_time_period": "Hour",
|
||||
"resolution_time": 6,
|
||||
"resolution_time_period": "Hour",
|
||||
"priorities": [
|
||||
{
|
||||
"priority": "Low",
|
||||
"response_time": 4,
|
||||
"response_time_period": "Hour",
|
||||
"resolution_time": 6,
|
||||
"resolution_time_period": "Hour",
|
||||
},
|
||||
{
|
||||
"priority": "Medium",
|
||||
"response_time": 4,
|
||||
"response_time_period": "Hour",
|
||||
"resolution_time": 6,
|
||||
"resolution_time_period": "Hour",
|
||||
},
|
||||
{
|
||||
"priority": "High",
|
||||
"response_time": 4,
|
||||
"response_time_period": "Hour",
|
||||
"resolution_time": 6,
|
||||
"resolution_time_period": "Hour",
|
||||
}
|
||||
],
|
||||
"support_and_resolution": [
|
||||
{
|
||||
"workday": "Monday",
|
||||
@ -67,10 +85,9 @@ def make_service_level_agreement():
|
||||
]
|
||||
})
|
||||
|
||||
default_service_level_agreement_exists = frappe.db.exists("Service Level Agreement", "__Test Service Level Agreement")
|
||||
default_service_level_agreement_exists = frappe.db.exists("Service Level Agreement", "Default Service Level Agreement")
|
||||
if not default_service_level_agreement_exists:
|
||||
default_service_level_agreement.insert()
|
||||
|
||||
default_service_level_agreement.insert(ignore_permissions=True)
|
||||
|
||||
customer = frappe.get_doc({
|
||||
"doctype": "Customer",
|
||||
@ -80,24 +97,42 @@ def make_service_level_agreement():
|
||||
"territory": "Rest Of The World"
|
||||
})
|
||||
if not frappe.db.exists("Customer", "_Test Customer"):
|
||||
customer.insert()
|
||||
customer.insert(ignore_permissions=True)
|
||||
else:
|
||||
customer = frappe.get_doc("Customer", "_Test Customer")
|
||||
|
||||
service_level_agreement = frappe.get_doc({
|
||||
"doctype": "Service Level Agreement",
|
||||
"name": "_Test Service Level Agreement",
|
||||
"sla_name": "_Test Service Level Agreement",
|
||||
"customer": customer.customer_name,
|
||||
"service_level": "_Test Service Level",
|
||||
"holiday_list": "__Test Holiday List",
|
||||
"priority": "Medium",
|
||||
"employee_group": "_Test Employee Group",
|
||||
"start_date": frappe.utils.getdate(),
|
||||
"end_date": frappe.utils.add_to_date(frappe.utils.getdate(), days=100),
|
||||
"response_time": 2,
|
||||
"response_time_period": "Day",
|
||||
"resolution_time": 3,
|
||||
"resolution_time_period": "Day",
|
||||
"priorities": [
|
||||
{
|
||||
"priority": "Low",
|
||||
"response_time": 2,
|
||||
"response_time_period": "Day",
|
||||
"resolution_time": 3,
|
||||
"resolution_time_period": "Day",
|
||||
},
|
||||
{
|
||||
"priority": "Medium",
|
||||
"response_time": 2,
|
||||
"response_time_period": "Day",
|
||||
"resolution_time": 3,
|
||||
"resolution_time_period": "Day",
|
||||
},
|
||||
{
|
||||
"priority": "High",
|
||||
"response_time": 2,
|
||||
"response_time_period": "Day",
|
||||
"resolution_time": 3,
|
||||
"resolution_time_period": "Day",
|
||||
}
|
||||
],
|
||||
"support_and_resolution": [
|
||||
{
|
||||
"workday": "Monday",
|
||||
@ -139,7 +174,7 @@ def make_service_level_agreement():
|
||||
|
||||
service_level_agreement_exists = frappe.db.exists("Service Level Agreement", "_Test Service Level Agreement")
|
||||
if not service_level_agreement_exists:
|
||||
service_level_agreement.insert()
|
||||
service_level_agreement.insert(ignore_permissions=True)
|
||||
return service_level_agreement.name
|
||||
else:
|
||||
return service_level_agreement_exists
|
||||
|
@ -69,6 +69,6 @@
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user