Skip to content

Commit

Permalink
fix: attach ticket to the file created via communication
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikSardana committed Dec 17, 2024
1 parent 622e906 commit b19e121
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ def reply_via_agent(
file_doc.attached_to_name = communication.name
file_doc.attached_to_doctype = "Communication"
file_doc.save(ignore_permissions=True)
self.attach_ticket_with_file(file_doc.content_hash, file_doc.file_url)

_attachments.append({"file_url": file_doc.file_url})

reply_to_email = sender_email.email_id
Expand Down Expand Up @@ -753,6 +755,14 @@ def on_communication_update(self, c):
# Save the ticket, allowing for hooks to run.
self.save()

def attach_ticket_with_file(self, content_hash, file_url):
file_doc = frappe.new_doc("File")
file_doc.attached_to_name = self.name
file_doc.attached_to_doctype = "HD Ticket"
file_doc.content_hash = content_hash
file_doc.file_url = file_url
file_doc.save(ignore_permissions=True)

@staticmethod
def default_list_data(show_customer_portal_fields=False):
columns = [
Expand Down

0 comments on commit b19e121

Please sign in to comment.