From a62043722ffdd68d0a11da70b24f880c6b0ddeea Mon Sep 17 00:00:00 2001 From: RitvikSardana Date: Tue, 17 Dec 2024 12:34:54 +0530 Subject: [PATCH] fix: show attachments on ticket creation --- helpdesk/helpdesk/doctype/hd_ticket/api.py | 1 + helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/helpdesk/helpdesk/doctype/hd_ticket/api.py b/helpdesk/helpdesk/doctype/hd_ticket/api.py index 9609d9774..68de9b532 100644 --- a/helpdesk/helpdesk/doctype/hd_ticket/api.py +++ b/helpdesk/helpdesk/doctype/hd_ticket/api.py @@ -15,6 +15,7 @@ def new(doc, attachments=[]): doc["doctype"] = "HD Ticket" doc["via_customer_portal"] = bool(frappe.session.user) + doc['attachments'] = attachments d = frappe.get_doc(doc).insert() return d diff --git a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py index 6c2d7d868..c1aa95475 100644 --- a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py +++ b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py @@ -617,6 +617,7 @@ def reply_via_agent( @frappe.whitelist() # flake8: noqa def create_communication_via_contact(self, message, attachments=[]): + if self.status == "Replied": self.status = "Open" log_ticket_activity(self.name, "set status to Open") @@ -637,6 +638,7 @@ def create_communication_via_contact(self, message, attachments=[]): c.ignore_mandatory = True c.save(ignore_permissions=True) + attachments = self.get("attachments", []) if not len(attachments): return QBFile = frappe.qb.DocType("File")