mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-13 17:20:36 +00:00
Merge develop into sla_fix
This commit is contained in:
@@ -112,12 +112,11 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"default": "Medium",
|
||||
"fieldname": "priority",
|
||||
"fieldtype": "Select",
|
||||
"fieldtype": "Link",
|
||||
"in_standard_filter": 1,
|
||||
"label": "Priority",
|
||||
"options": "Low\nMedium\nHigh"
|
||||
"options": "Issue Priority"
|
||||
},
|
||||
{
|
||||
"fieldname": "issue_type",
|
||||
@@ -337,7 +336,7 @@
|
||||
],
|
||||
"icon": "fa fa-ticket",
|
||||
"idx": 7,
|
||||
"modified": "2019-05-19 11:02:10.962090",
|
||||
"modified": "2019-05-20 15:19:00.771333",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Issue",
|
||||
|
||||
@@ -128,6 +128,8 @@ class Issue(Document):
|
||||
return replicated_issue.name
|
||||
|
||||
def before_insert(self):
|
||||
if not self.priority:
|
||||
self.priority = frappe.db.get_value("Issue Priority", {"default_priority": 1})
|
||||
self.set_response_and_resolution_time(priority=self.priority)
|
||||
|
||||
def set_response_and_resolution_time(self, priority=None, service_level_agreement=None):
|
||||
@@ -153,7 +155,6 @@ class Issue(Document):
|
||||
self.creation = now_datetime()
|
||||
|
||||
start_date_time = get_datetime(self.creation)
|
||||
|
||||
self.response_by = get_expected_time_for(parameter='response', service_level=priority, start_date_time=start_date_time)
|
||||
self.resolution_by = get_expected_time_for(parameter='resolution', service_level=priority, start_date_time=start_date_time)
|
||||
|
||||
|
||||
0
erpnext/support/doctype/issue_priority/__init__.py
Normal file
0
erpnext/support/doctype/issue_priority/__init__.py
Normal file
8
erpnext/support/doctype/issue_priority/issue_priority.js
Normal file
8
erpnext/support/doctype/issue_priority/issue_priority.js
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Issue Priority', {
|
||||
// refresh: function(frm) {
|
||||
|
||||
// }
|
||||
});
|
||||
39
erpnext/support/doctype/issue_priority/issue_priority.json
Normal file
39
erpnext/support/doctype/issue_priority/issue_priority.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"autoname": "Prompt",
|
||||
"creation": "2019-05-20 15:14:21.604447",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"description"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Description"
|
||||
}
|
||||
],
|
||||
"modified": "2019-05-20 17:06:38.095647",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Issue Priority",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC",
|
||||
"track_changes": 1
|
||||
}
|
||||
14
erpnext/support/doctype/issue_priority/issue_priority.py
Normal file
14
erpnext/support/doctype/issue_priority/issue_priority.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
|
||||
class IssuePriority(Document):
|
||||
|
||||
def validate(self):
|
||||
if frappe.db.exists("Issue Priority", {"name": self.name}):
|
||||
frappe.throw(_("Issue Priority Already Exists"))
|
||||
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
class TestIssuePriority(unittest.TestCase):
|
||||
pass
|
||||
|
||||
def make_priorities():
|
||||
insert_priority("Low")
|
||||
insert_priority("Medium")
|
||||
insert_priority("High")
|
||||
|
||||
def insert_priority(name):
|
||||
frappe.get_doc({
|
||||
"doctype": "Issue Priority",
|
||||
"name": name,
|
||||
"default_priority": 1 if name == "Medium" else 0
|
||||
}).insert(ignore_permissions=True)
|
||||
@@ -12,10 +12,12 @@ from frappe.utils import get_weekdays
|
||||
class ServiceLevel(Document):
|
||||
|
||||
def validate(self):
|
||||
self.check_default_priority()
|
||||
self.check_priorities()
|
||||
self.check_support_and_resolution()
|
||||
|
||||
def check_priorities(self):
|
||||
default_priority = []
|
||||
priorities = []
|
||||
|
||||
for priority in self.priorities:
|
||||
@@ -24,6 +26,7 @@ class ServiceLevel(Document):
|
||||
frappe.throw(_("Set Response Time and Resolution for Priority {0} at index {1}.".format(priority.priority, priority.idx)))
|
||||
|
||||
priorities.append(priority.priority)
|
||||
#priorities.append(priority.priority)
|
||||
|
||||
if priority.response_time_period == "Hour":
|
||||
response = priority.response_time * 0.0416667
|
||||
@@ -47,11 +50,6 @@ class ServiceLevel(Document):
|
||||
repeated_priority = get_repeated(priorities)
|
||||
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 {0}.".format(" ".join(priority_count))))
|
||||
|
||||
def check_support_and_resolution(self):
|
||||
week = get_weekdays()
|
||||
support_days = []
|
||||
@@ -77,13 +75,16 @@ class ServiceLevel(Document):
|
||||
def get_service_level_priority(self, priority):
|
||||
priority = frappe.get_doc("Service Level Priority", {"priority": priority, "parent": self.name})
|
||||
|
||||
return frappe._dict({
|
||||
"priority": priority.priority,
|
||||
"response_time": priority.response_time,
|
||||
"response_time_period": priority.response_time_period,
|
||||
"resolution_time": priority.resolution_time,
|
||||
"resolution_time_period": priority.resolution_time_period
|
||||
})
|
||||
if priority:
|
||||
return frappe._dict({
|
||||
"priority": priority.priority,
|
||||
"response_time": priority.response_time,
|
||||
"response_time_period": priority.response_time_period,
|
||||
"resolution_time": priority.resolution_time,
|
||||
"resolution_time_period": priority.resolution_time_period
|
||||
})
|
||||
else:
|
||||
frappe.throw(_("Service Level {0} doesn't have Priority {1}.".format(self.name, priority)))
|
||||
|
||||
def get_repeated(values):
|
||||
unique_list = []
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
from erpnext.hr.doctype.employee_group.test_employee_group import make_employee_group
|
||||
from erpnext.support.doctype.issue_priority.test_issue_priority import make_priorities
|
||||
from frappe.utils import now_datetime
|
||||
import datetime
|
||||
from datetime import timedelta
|
||||
@@ -16,6 +17,7 @@ class TestServiceLevel(unittest.TestCase):
|
||||
def make_service_level():
|
||||
employee_group = make_employee_group()
|
||||
make_holiday_list()
|
||||
make_priorities()
|
||||
|
||||
# Default Service Level Agreement
|
||||
default_service_level = frappe.get_doc({
|
||||
|
||||
@@ -134,13 +134,14 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval: !doc.default_service_level_agreement",
|
||||
"fieldname": "ignore_start_and_end_date",
|
||||
"fieldtype": "Check",
|
||||
"label": "Ignore Start and End Date",
|
||||
"set_only_once": 1
|
||||
}
|
||||
],
|
||||
"modified": "2019-05-19 09:41:55.498800",
|
||||
"modified": "2019-05-20 15:36:00.326471",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Service Level Agreement",
|
||||
|
||||
@@ -14,13 +14,13 @@ class ServiceLevelAgreement(Document):
|
||||
if frappe.db.exists("Service Level Agreement", {"default_service_level_agreement": "1", "name": ["!=", self.name]}):
|
||||
frappe.throw(_("A Default Service Level Agreement already exists."))
|
||||
else:
|
||||
if not (self.start_date and self.end_date) and self.ignore_start_and_end_date:
|
||||
if not self.ignore_start_and_end_date and 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 and self.ignore_start_and_end_date:
|
||||
if not self.ignore_start_and_end_date and 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() and self.ignore_start_and_end_date:
|
||||
if not self.ignore_start_and_end_date and self.end_date < frappe.utils.getdate():
|
||||
frappe.throw(_("End Date of Agreement can't be less than today."))
|
||||
|
||||
def check_agreement_status():
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"priority",
|
||||
"cb_01",
|
||||
"default_priority",
|
||||
"sb_00",
|
||||
"response_time",
|
||||
"response_time_period",
|
||||
@@ -16,10 +18,10 @@
|
||||
{
|
||||
"columns": 2,
|
||||
"fieldname": "priority",
|
||||
"fieldtype": "Select",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Priority",
|
||||
"options": "Low\nMedium\nHigh"
|
||||
"options": "Issue Priority"
|
||||
},
|
||||
{
|
||||
"fieldname": "sb_00",
|
||||
@@ -58,10 +60,20 @@
|
||||
"in_list_view": 1,
|
||||
"label": "Resolution Time Period",
|
||||
"options": "Hour\nDay\nWeek"
|
||||
},
|
||||
{
|
||||
"fieldname": "cb_01",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "default_priority",
|
||||
"fieldtype": "Check",
|
||||
"label": "Default Priority"
|
||||
}
|
||||
],
|
||||
"istable": 1,
|
||||
"modified": "2019-05-04 06:04:32.956731",
|
||||
"modified": "2019-05-20 17:10:43.687547",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Service Level Priority",
|
||||
|
||||
Reference in New Issue
Block a user