From 63333c3445eecbf3d9540bd391c924559c2a1ee1 Mon Sep 17 00:00:00 2001 From: Sabu Siyad Date: Mon, 23 Oct 2023 12:11:22 +0530 Subject: [PATCH] fix(ux): set first response at even without `replied` status --- helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py index aa9187a31..48b937480 100644 --- a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py +++ b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py @@ -167,7 +167,6 @@ def before_validate(self): self.set_contact() self.set_customer() self.set_priority() - self.set_first_responded_on() self.set_feedback_values() self.apply_escalation_rule() self.set_sla() @@ -233,10 +232,6 @@ def set_priority(self): or DEFAULT_TICKET_PRIORITY ) - def set_first_responded_on(self): - if self.status == "Replied" and not self.first_responded_on: - self.first_responded_on = frappe.utils.now_datetime() - def set_feedback_values(self): if not self.feedback: return @@ -738,6 +733,12 @@ def on_communication_update(self, c): # be reopened. if c.sent_or_received == "Received": self.status = "Open" + # If communication is outgoing, it must be a reply from agent + if c.sent_or_received == "Sent": + # Set first response date if not set already + self.first_responded_on = ( + self.first_responded_on or frappe.utils.now_datetime() + ) # Fetch description from communication if not set already. This might not be needed # anymore as a communication is created when a ticket is created. self.description = self.description or c.content