Skip to content

Commit

Permalink
fix: handle case for existing tickets attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikSardana committed Dec 17, 2024
1 parent a620437 commit 7f58251
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,11 +638,12 @@ 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):
_attachments = self.get("attachments", attachments)

if not len(_attachments):
return
QBFile = frappe.qb.DocType("File")
condition_name = [QBFile.name == i["name"] for i in attachments]
condition_name = [QBFile.name == i["name"] for i in _attachments]
frappe.qb.update(QBFile).set(QBFile.attached_to_name, c.name).set(
QBFile.attached_to_doctype, "Communication"
).where(Criterion.any(condition_name)).run()
Expand Down

0 comments on commit 7f58251

Please sign in to comment.