fix(Issue): reset response_by and resolution_by if SLA is removed (#25997)
This commit is contained in:
parent
b066fe9519
commit
3d8f82459b
@ -166,7 +166,7 @@
|
||||
"options": "Service Level Agreement"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval: doc.status != 'Replied';",
|
||||
"depends_on": "eval: doc.status != 'Replied' && doc.service_level_agreement;",
|
||||
"fieldname": "response_by",
|
||||
"fieldtype": "Datetime",
|
||||
"label": "Response By",
|
||||
@ -180,7 +180,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval: doc.status != 'Replied';",
|
||||
"depends_on": "eval: doc.status != 'Replied' && doc.service_level_agreement;",
|
||||
"fieldname": "resolution_by",
|
||||
"fieldtype": "Datetime",
|
||||
"label": "Resolution By",
|
||||
@ -410,7 +410,7 @@
|
||||
"icon": "fa fa-ticket",
|
||||
"idx": 7,
|
||||
"links": [],
|
||||
"modified": "2021-05-26 10:49:07.574769",
|
||||
"modified": "2021-06-10 03:22:27.098898",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Issue",
|
||||
|
@ -29,6 +29,9 @@ class Issue(Document):
|
||||
self.update_status()
|
||||
self.set_lead_contact(self.raised_by)
|
||||
|
||||
if not self.service_level_agreement:
|
||||
self.reset_sla_fields()
|
||||
|
||||
def on_update(self):
|
||||
# Add a communication in the issue timeline
|
||||
if self.flags.create_communication and self.via_customer_portal:
|
||||
@ -54,6 +57,13 @@ class Issue(Document):
|
||||
self.company = frappe.db.get_value("Lead", self.lead, "company") or \
|
||||
frappe.db.get_default("Company")
|
||||
|
||||
def reset_sla_fields(self):
|
||||
self.agreement_status = ""
|
||||
self.response_by = ""
|
||||
self.resolution_by = ""
|
||||
self.response_by_variance = 0
|
||||
self.resolution_by_variance = 0
|
||||
|
||||
def update_status(self):
|
||||
status = frappe.db.get_value("Issue", self.name, "status")
|
||||
if self.status != "Open" and status == "Open" and not self.first_responded_on:
|
||||
@ -511,4 +521,4 @@ def get_time_in_timedelta(time):
|
||||
Converts datetime.time(10, 36, 55, 961454) to datetime.timedelta(seconds=38215)
|
||||
"""
|
||||
import datetime
|
||||
return datetime.timedelta(hours=time.hour, minutes=time.minute, seconds=time.second)
|
||||
return datetime.timedelta(hours=time.hour, minutes=time.minute, seconds=time.second)
|
||||
|
Loading…
x
Reference in New Issue
Block a user