fix(Issue): track split from in issue (#18994)

* fix: track split from in issue

* fix: rename field name

* fix: remove first_mins to response
This commit is contained in:
Himanshu 2019-09-11 19:20:20 +05:30 committed by Nabin Hait
parent cd38ba4833
commit e3ef56804c
3 changed files with 403 additions and 384 deletions

View File

@ -107,7 +107,7 @@ frappe.ui.form.on("Issue", {
}, () => { }, () => {
reset_sla.enable_primary_action(); reset_sla.enable_primary_action();
frm.refresh(); frm.refresh();
frappe.msgprint(__("Service Level Agreement Reset.")); frappe.msgprint(__("Service Level Agreement was reset."));
}); });
} }
}); });

View File

@ -1,384 +1,392 @@
{ {
"allow_import": 1, "allow_import": 1,
"allow_rename": 1, "allow_rename": 1,
"autoname": "naming_series:", "autoname": "naming_series:",
"creation": "2013-02-01 10:36:25", "creation": "2013-02-01 10:36:25",
"doctype": "DocType", "doctype": "DocType",
"document_type": "Setup", "document_type": "Setup",
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"subject_section", "subject_section",
"naming_series", "naming_series",
"subject", "subject",
"customer", "customer",
"raised_by", "raised_by",
"cb00", "cb00",
"status", "status",
"priority", "priority",
"issue_type", "issue_type",
"sb_details", "issue_split_from",
"description", "sb_details",
"service_level_section", "description",
"service_level_agreement", "service_level_section",
"response_by", "service_level_agreement",
"response_by_variance", "response_by",
"reset_service_level_agreement", "response_by_variance",
"cb", "reset_service_level_agreement",
"agreement_fulfilled", "cb",
"resolution_by", "agreement_fulfilled",
"resolution_by_variance", "resolution_by",
"service_level_agreement_creation", "resolution_by_variance",
"response", "service_level_agreement_creation",
"mins_to_first_response", "response",
"first_responded_on", "mins_to_first_response",
"additional_info", "first_responded_on",
"lead", "additional_info",
"contact", "lead",
"email_account", "contact",
"column_break_16", "email_account",
"customer_name", "column_break_16",
"project", "customer_name",
"company", "project",
"section_break_19", "company",
"resolution_details", "section_break_19",
"column_break1", "resolution_details",
"opening_date", "column_break1",
"opening_time", "opening_date",
"resolution_date", "opening_time",
"content_type", "resolution_date",
"attachment", "content_type",
"via_customer_portal" "attachment",
], "via_customer_portal"
"fields": [ ],
{ "fields": [
"fieldname": "subject_section", {
"fieldtype": "Section Break", "fieldname": "subject_section",
"label": "Subject", "fieldtype": "Section Break",
"options": "fa fa-flag" "label": "Subject",
}, "options": "fa fa-flag"
{ },
"fieldname": "naming_series", {
"fieldtype": "Select", "fieldname": "naming_series",
"label": "Series", "fieldtype": "Select",
"no_copy": 1, "label": "Series",
"options": "ISS-.YYYY.-", "no_copy": 1,
"print_hide": 1, "options": "ISS-.YYYY.-",
"set_only_once": 1 "print_hide": 1,
}, "set_only_once": 1
{ },
"bold": 1, {
"fieldname": "subject", "bold": 1,
"fieldtype": "Data", "fieldname": "subject",
"in_global_search": 1, "fieldtype": "Data",
"in_standard_filter": 1, "in_global_search": 1,
"label": "Subject", "in_standard_filter": 1,
"reqd": 1 "label": "Subject",
}, "reqd": 1
{ },
"fieldname": "customer", {
"fieldtype": "Link", "fieldname": "customer",
"in_global_search": 1, "fieldtype": "Link",
"label": "Customer", "in_global_search": 1,
"oldfieldname": "customer", "label": "Customer",
"oldfieldtype": "Link", "oldfieldname": "customer",
"options": "Customer", "oldfieldtype": "Link",
"print_hide": 1, "options": "Customer",
"search_index": 1 "print_hide": 1,
}, "search_index": 1
{ },
"bold": 1, {
"depends_on": "eval:doc.__islocal", "bold": 1,
"fieldname": "raised_by", "depends_on": "eval:doc.__islocal",
"fieldtype": "Data", "fieldname": "raised_by",
"in_global_search": 1, "fieldtype": "Data",
"in_list_view": 1, "in_global_search": 1,
"label": "Raised By (Email)", "in_list_view": 1,
"oldfieldname": "raised_by", "label": "Raised By (Email)",
"oldfieldtype": "Data", "oldfieldname": "raised_by",
"options": "Email" "oldfieldtype": "Data",
}, "options": "Email"
{ },
"fieldname": "cb00", {
"fieldtype": "Column Break" "fieldname": "cb00",
}, "fieldtype": "Column Break"
{ },
"default": "Open", {
"fieldname": "status", "default": "Open",
"fieldtype": "Select", "fieldname": "status",
"in_list_view": 1, "fieldtype": "Select",
"in_standard_filter": 1, "in_list_view": 1,
"label": "Status", "in_standard_filter": 1,
"no_copy": 1, "label": "Status",
"oldfieldname": "status", "no_copy": 1,
"oldfieldtype": "Select", "oldfieldname": "status",
"options": "Open\nReplied\nHold\nClosed", "oldfieldtype": "Select",
"search_index": 1 "options": "Open\nReplied\nHold\nClosed",
}, "search_index": 1
{ },
"default": "Medium", {
"fieldname": "priority", "default": "Medium",
"fieldtype": "Link", "fieldname": "priority",
"in_standard_filter": 1, "fieldtype": "Link",
"label": "Priority", "in_standard_filter": 1,
"options": "Issue Priority" "label": "Priority",
}, "options": "Issue Priority"
{ },
"fieldname": "issue_type", {
"fieldtype": "Link", "fieldname": "issue_type",
"label": "Issue Type", "fieldtype": "Link",
"options": "Issue Type" "label": "Issue Type",
}, "options": "Issue Type"
{ },
"collapsible": 1, {
"collapsible_depends_on": "eval:doc.status!=\"Closed\"", "collapsible": 1,
"fieldname": "sb_details", "collapsible_depends_on": "eval:doc.status!=\"Closed\"",
"fieldtype": "Section Break", "fieldname": "sb_details",
"label": "Details" "fieldtype": "Section Break",
}, "label": "Details"
{ },
"bold": 1, {
"fieldname": "description", "bold": 1,
"fieldtype": "Text Editor", "fieldname": "description",
"in_global_search": 1, "fieldtype": "Text Editor",
"label": "Description", "in_global_search": 1,
"oldfieldname": "problem_description", "label": "Description",
"oldfieldtype": "Text" "oldfieldname": "problem_description",
}, "oldfieldtype": "Text"
{ },
"collapsible": 1, {
"fieldname": "service_level_section", "collapsible": 1,
"fieldtype": "Section Break", "fieldname": "service_level_section",
"label": "Service Level" "fieldtype": "Section Break",
}, "label": "Service Level"
{ },
"fieldname": "service_level_agreement", {
"fieldtype": "Link", "fieldname": "service_level_agreement",
"label": "Service Level Agreement", "fieldtype": "Link",
"options": "Service Level Agreement" "label": "Service Level Agreement",
}, "options": "Service Level Agreement"
{ },
"fieldname": "response_by", {
"fieldtype": "Datetime", "fieldname": "response_by",
"label": "Response By", "fieldtype": "Datetime",
"read_only": 1 "label": "Response By",
}, "read_only": 1
{ },
"collapsible": 1, {
"fieldname": "cb", "collapsible": 1,
"fieldtype": "Column Break", "fieldname": "cb",
"options": "fa fa-pushpin", "fieldtype": "Column Break",
"read_only": 1 "options": "fa fa-pushpin",
}, "read_only": 1
{ },
"fieldname": "resolution_by", {
"fieldtype": "Datetime", "fieldname": "resolution_by",
"label": "Resolution By", "fieldtype": "Datetime",
"read_only": 1 "label": "Resolution By",
}, "read_only": 1
{ },
"collapsible": 1, {
"fieldname": "response", "collapsible": 1,
"fieldtype": "Section Break", "fieldname": "response",
"label": "Response" "fieldtype": "Section Break",
}, "label": "Response"
{ },
"bold": 1, {
"fieldname": "mins_to_first_response", "bold": 1,
"fieldtype": "Float", "fieldname": "mins_to_first_response",
"label": "Mins to First Response", "fieldtype": "Float",
"read_only": 1 "label": "Mins to First Response",
}, "read_only": 1
{ },
"fieldname": "first_responded_on", {
"fieldtype": "Datetime", "fieldname": "first_responded_on",
"label": "First Responded On" "fieldtype": "Datetime",
}, "label": "First Responded On"
{ },
"collapsible": 1, {
"fieldname": "additional_info", "collapsible": 1,
"fieldtype": "Section Break", "fieldname": "additional_info",
"label": "Reference", "fieldtype": "Section Break",
"options": "fa fa-pushpin", "label": "Reference",
"read_only": 1 "options": "fa fa-pushpin",
}, "read_only": 1
{ },
"fieldname": "lead", {
"fieldtype": "Link", "fieldname": "lead",
"label": "Lead", "fieldtype": "Link",
"options": "Lead" "label": "Lead",
}, "options": "Lead"
{ },
"fieldname": "contact", {
"fieldtype": "Link", "fieldname": "contact",
"label": "Contact", "fieldtype": "Link",
"options": "Contact" "label": "Contact",
}, "options": "Contact"
{ },
"fieldname": "email_account", {
"fieldtype": "Link", "fieldname": "email_account",
"label": "Email Account", "fieldtype": "Link",
"options": "Email Account" "label": "Email Account",
}, "options": "Email Account"
{ },
"fieldname": "column_break_16", {
"fieldtype": "Column Break" "fieldname": "column_break_16",
}, "fieldtype": "Column Break"
{ },
"bold": 1, {
"fieldname": "customer_name", "bold": 1,
"fieldtype": "Data", "fieldname": "customer_name",
"label": "Customer Name", "fieldtype": "Data",
"oldfieldname": "customer_name", "label": "Customer Name",
"oldfieldtype": "Data", "oldfieldname": "customer_name",
"read_only": 1 "oldfieldtype": "Data",
}, "read_only": 1
{ },
"fieldname": "project", {
"fieldtype": "Link", "fieldname": "project",
"label": "Project", "fieldtype": "Link",
"options": "Project" "label": "Project",
}, "options": "Project"
{ },
"fieldname": "company", {
"fieldtype": "Link", "fieldname": "company",
"label": "Company", "fieldtype": "Link",
"options": "Company", "label": "Company",
"print_hide": 1 "options": "Company",
}, "print_hide": 1
{ },
"collapsible": 1, {
"fieldname": "section_break_19", "collapsible": 1,
"fieldtype": "Section Break", "fieldname": "section_break_19",
"label": "Resolution" "fieldtype": "Section Break",
}, "label": "Resolution"
{ },
"depends_on": "eval:!doc.__islocal", {
"fieldname": "resolution_details", "depends_on": "eval:!doc.__islocal",
"fieldtype": "Text Editor", "fieldname": "resolution_details",
"label": "Resolution Details", "fieldtype": "Text Editor",
"no_copy": 1, "label": "Resolution Details",
"oldfieldname": "resolution_details", "no_copy": 1,
"oldfieldtype": "Text" "oldfieldname": "resolution_details",
}, "oldfieldtype": "Text"
{ },
"depends_on": "eval:!doc.__islocal", {
"fieldname": "column_break1", "depends_on": "eval:!doc.__islocal",
"fieldtype": "Column Break", "fieldname": "column_break1",
"oldfieldtype": "Column Break", "fieldtype": "Column Break",
"read_only": 1 "oldfieldtype": "Column Break",
}, "read_only": 1
{ },
"default": "Today", {
"fieldname": "opening_date", "default": "Today",
"fieldtype": "Date", "fieldname": "opening_date",
"label": "Opening Date", "fieldtype": "Date",
"no_copy": 1, "label": "Opening Date",
"oldfieldname": "opening_date", "no_copy": 1,
"oldfieldtype": "Date", "oldfieldname": "opening_date",
"read_only": 1 "oldfieldtype": "Date",
}, "read_only": 1
{ },
"fieldname": "opening_time", {
"fieldtype": "Time", "fieldname": "opening_time",
"label": "Opening Time", "fieldtype": "Time",
"no_copy": 1, "label": "Opening Time",
"oldfieldname": "opening_time", "no_copy": 1,
"oldfieldtype": "Time", "oldfieldname": "opening_time",
"read_only": 1 "oldfieldtype": "Time",
}, "read_only": 1
{ },
"depends_on": "eval:!doc.__islocal", {
"fieldname": "resolution_date", "depends_on": "eval:!doc.__islocal",
"fieldtype": "Datetime", "fieldname": "resolution_date",
"label": "Resolution Date", "fieldtype": "Datetime",
"no_copy": 1, "label": "Resolution Date",
"oldfieldname": "resolution_date", "no_copy": 1,
"oldfieldtype": "Date", "oldfieldname": "resolution_date",
"read_only": 1 "oldfieldtype": "Date",
}, "read_only": 1
{ },
"fieldname": "content_type", {
"fieldtype": "Data", "fieldname": "content_type",
"hidden": 1, "fieldtype": "Data",
"label": "Content Type" "hidden": 1,
}, "label": "Content Type"
{ },
"fieldname": "attachment", {
"fieldtype": "Attach", "fieldname": "attachment",
"hidden": 1, "fieldtype": "Attach",
"label": "Attachment" "hidden": 1,
}, "label": "Attachment"
{ },
"default": "0", {
"fieldname": "via_customer_portal", "default": "0",
"fieldtype": "Check", "fieldname": "via_customer_portal",
"label": "Via Customer Portal" "fieldtype": "Check",
}, "label": "Via Customer Portal"
{ },
"default": "Ongoing", {
"depends_on": "eval: doc.service_level_agreement", "default": "Ongoing",
"fieldname": "agreement_fulfilled", "depends_on": "eval: doc.service_level_agreement",
"fieldtype": "Select", "fieldname": "agreement_fulfilled",
"label": "Service Level Agreement Fulfilled", "fieldtype": "Select",
"options": "Ongoing\nFulfilled\nFailed", "label": "Service Level Agreement Fulfilled",
"read_only": 1 "options": "Ongoing\nFulfilled\nFailed",
}, "read_only": 1
{ },
"depends_on": "eval: doc.service_level_agreement", {
"description": "in hours", "depends_on": "eval: doc.service_level_agreement",
"fieldname": "response_by_variance", "description": "in hours",
"fieldtype": "Float", "fieldname": "response_by_variance",
"label": "Response By Variance", "fieldtype": "Float",
"read_only": 1 "label": "Response By Variance",
}, "read_only": 1
{ },
"depends_on": "eval: doc.service_level_agreement", {
"description": "in hours", "depends_on": "eval: doc.service_level_agreement",
"fieldname": "resolution_by_variance", "description": "in hours",
"fieldtype": "Float", "fieldname": "resolution_by_variance",
"label": "Resolution By Variance", "fieldtype": "Float",
"read_only": 1 "label": "Resolution By Variance",
}, "read_only": 1
{ },
"fieldname": "service_level_agreement_creation", {
"fieldtype": "Datetime", "fieldname": "service_level_agreement_creation",
"hidden": 1, "fieldtype": "Datetime",
"label": "Service Level Agreement Creation", "hidden": 1,
"read_only": 1 "label": "Service Level Agreement Creation",
}, "read_only": 1
{ },
"depends_on": "eval: doc.service_level_agreement", {
"fieldname": "reset_service_level_agreement", "depends_on": "eval: doc.service_level_agreement",
"fieldtype": "Button", "fieldname": "reset_service_level_agreement",
"label": "Reset Service Level Agreement" "fieldtype": "Button",
} "label": "Reset Service Level Agreement"
], },
"icon": "fa fa-ticket", {
"idx": 7, "fieldname": "issue_split_from",
"modified": "2019-07-11 23:57:22.015881", "fieldtype": "Link",
"modified_by": "Administrator", "label": "Issue Split From",
"module": "Support", "options": "Issue",
"name": "Issue", "read_only": 1
"owner": "Administrator", }
"permissions": [ ],
{ "icon": "fa fa-ticket",
"create": 1, "idx": 7,
"delete": 1, "modified": "2019-09-11 09:03:57.465623",
"email": 1, "modified_by": "himanshu@erpnext.com",
"print": 1, "module": "Support",
"read": 1, "name": "Issue",
"report": 1, "owner": "Administrator",
"role": "Support Team", "permissions": [
"share": 1, {
"write": 1 "create": 1,
} "delete": 1,
], "email": 1,
"quick_entry": 1, "print": 1,
"search_fields": "status,customer,subject,raised_by", "read": 1,
"sort_field": "modified", "report": 1,
"sort_order": "ASC", "role": "Support Team",
"timeline_field": "customer", "share": 1,
"title_field": "subject", "write": 1
"track_changes": 1, }
"track_seen": 1 ],
} "quick_entry": 1,
"search_fields": "status,customer,subject,raised_by",
"sort_field": "modified",
"sort_order": "ASC",
"timeline_field": "customer",
"title_field": "subject",
"track_changes": 1,
"track_seen": 1
}

View File

@ -117,6 +117,9 @@ class Issue(Document):
replicated_issue = deepcopy(self) replicated_issue = deepcopy(self)
replicated_issue.subject = subject replicated_issue.subject = subject
replicated_issue.issue_split_from = self.name
replicated_issue.mins_to_first_response = 0
replicated_issue.first_responded_on = None
replicated_issue.creation = now_datetime() replicated_issue.creation = now_datetime()
# Reset SLA # Reset SLA
@ -144,6 +147,14 @@ class Issue(Document):
doc.reference_name = replicated_issue.name doc.reference_name = replicated_issue.name
doc.save(ignore_permissions=True) doc.save(ignore_permissions=True)
frappe.get_doc({
"doctype": "Comment",
"comment_type": "Info",
"reference_doctype": "Issue",
"reference_name": replicated_issue.name,
"content": " - Split the Issue from <a href='#Form/Issue/{0}'>{1}</a>".format(self.name, frappe.bold(self.name)),
}).insert(ignore_permissions=True)
return replicated_issue.name return replicated_issue.name
def before_insert(self): def before_insert(self):