feat: dashboards

This commit is contained in:
Himanshu Warekar 2019-06-06 14:13:10 +05:30
parent b318b83bb7
commit ab97cd4db1
5 changed files with 54 additions and 47 deletions

View File

@ -51,7 +51,7 @@
{
"fieldname": "section_break_01",
"fieldtype": "Section Break",
"label": "Support and Resolution"
"label": "Support Hours"
},
{
"fieldname": "support_and_resolution",
@ -75,7 +75,7 @@
"read_only": 1
}
],
"modified": "2019-06-05 13:37:20.342946",
"modified": "2019-06-06 12:58:03.464056",
"modified_by": "Administrator",
"module": "Support",
"name": "Service Level",

View File

@ -0,0 +1,12 @@
from frappe import _
def get_data():
return {
'fieldname': 'service_level',
'transactions': [
{
'label': _('Service Level Agreement'),
'items': ['Service Level Agreement']
}
]
}

View File

@ -1,24 +1,22 @@
{
"autoname": "format:SLA-{service_level_agreement_name}",
"autoname": "format:SLA-{service_level}-{####}",
"creation": "2018-12-26 21:08:15.448812",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"service_level_agreement_name",
"service_level",
"customer",
"default_service_level_agreement",
"holiday_list",
"column_break_2",
"service_level",
"employee_group",
"default_priority",
"agreement_details_section",
"start_date",
"agreement_status",
"active",
"column_break_7",
"end_date",
"ignore_start_and_end_date",
"response_and_resolution_time_section",
"priorities",
"support_and_resolution_section_break",
@ -30,6 +28,7 @@
"fieldname": "customer",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Customer",
"options": "Customer",
"set_only_once": 1
@ -39,7 +38,6 @@
"depends_on": "eval: !doc.customer;",
"fieldname": "default_service_level_agreement",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Default Service Level Agreement",
"set_only_once": 1
},
@ -47,6 +45,7 @@
"fieldname": "service_level",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Service Level",
"options": "Service Level",
"reqd": 1,
@ -68,6 +67,8 @@
"fetch_from": "service_level.employee_group",
"fieldname": "employee_group",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Employee Group",
"options": "Employee Group",
"read_only": 1
@ -83,14 +84,6 @@
"fieldtype": "Date",
"label": "Start Date"
},
{
"default": "Active",
"fieldname": "agreement_status",
"fieldtype": "Select",
"label": "Agreement Status",
"options": "Active\nExpired",
"read_only": 1
},
{
"depends_on": "eval: !doc.default_contract",
"fieldname": "column_break_7",
@ -106,13 +99,13 @@
"collapsible": 1,
"fieldname": "response_and_resolution_time_section",
"fieldtype": "Section Break",
"label": "Priorities, Response and Resolution Time"
"label": "Response and Resolution Time"
},
{
"collapsible": 1,
"fieldname": "support_and_resolution_section_break",
"fieldtype": "Section Break",
"label": "Support and Resolution"
"label": "Support Hours"
},
{
"fieldname": "support_and_resolution",
@ -126,21 +119,6 @@
"label": "Priorities",
"options": "Service Level Priority"
},
{
"fieldname": "service_level_agreement_name",
"fieldtype": "Data",
"label": "Service Level Agreement Name",
"reqd": 1,
"unique": 1
},
{
"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
},
{
"fetch_from": "service_level.default_priority",
"fieldname": "default_priority",
@ -148,9 +126,16 @@
"label": "Default Priority",
"options": "Issue Priority",
"read_only": 1
},
{
"default": "1",
"fieldname": "active",
"fieldtype": "Check",
"label": "Active",
"read_only": 1
}
],
"modified": "2019-06-06 12:03:11.247979",
"modified": "2019-06-06 12:56:24.545060",
"modified_by": "Administrator",
"module": "Support",
"name": "Service Level Agreement",

View File

@ -14,14 +14,12 @@ 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.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 and self.end_date:
if self.start_date >= self.end_date:
frappe.throw(_("Start Date of Agreement can't be greater than or equal to 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 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."))
if self.end_date < frappe.utils.getdate():
frappe.throw(_("End Date of Agreement can't be less than today."))
def get_service_level_agreement_priority(self, priority):
priority = frappe.get_doc("Service Level Priority", {"priority": priority, "parent": self.name})
@ -36,18 +34,18 @@ class ServiceLevelAgreement(Document):
def check_agreement_status():
service_level_agreements = frappe.get_list("Service Level Agreement", filters=[
{"agreement_status": "Active"},
{"active": 1},
{"default_service_level_agreement": 0}
], fields=["name", "end_date"])
], fields=["name"])
for service_level_agreement in service_level_agreements:
if service_level_agreement.end_date < frappe.utils.getdate():
frappe.db.set_value("Service Level Agreement", service_level_agreement.name,
"agreement_status", "Expired")
doc = frappe.get_doc("Service Level Agreement", service_level_agreement.name)
if doc.end_date and doc.end_date < frappe.utils.getdate():
frappe.db.set_value("Service Level Agreement", service_level_agreement.name, "active", 0)
def get_active_service_level_agreement_for(priority, customer=None, service_level_agreement=None):
filters = [
["Service Level Agreement", "agreement_status", "=", "Active"]
["Service Level Agreement", "active", "=", 1]
]
if priority:

View File

@ -0,0 +1,12 @@
from frappe import _
def get_data():
return {
'fieldname': 'service_level_agreement',
'transactions': [
{
'label': _('Issue'),
'items': ['Issue']
}
]
}