diff --git a/helpdesk_mgmt/controllers/main.py b/helpdesk_mgmt/controllers/main.py index 4c43176d0c..0fe3799d4f 100644 --- a/helpdesk_mgmt/controllers/main.py +++ b/helpdesk_mgmt/controllers/main.py @@ -91,10 +91,12 @@ def submit_ticket(self, **kw): new_ticket = request.env["helpdesk.ticket"].sudo().create(vals) new_ticket.message_subscribe(partner_ids=request.env.user.partner_id.ids) if kw.get("attachment"): + IrAttachment = request.env["ir.attachment"] + attachment_ids = IrAttachment for c_file in request.httprequest.files.getlist("attachment"): data = c_file.read() if c_file.filename: - request.env["ir.attachment"].sudo().create( + attachment_ids += IrAttachment.sudo().create( { "name": c_file.filename, "datas": base64.b64encode(data), @@ -102,4 +104,5 @@ def submit_ticket(self, **kw): "res_id": new_ticket.id, } ) + attachment_ids.sudo().generate_access_token() return werkzeug.utils.redirect("/my/ticket/%s" % new_ticket.id) diff --git a/helpdesk_mgmt/views/helpdesk_ticket_templates.xml b/helpdesk_mgmt/views/helpdesk_ticket_templates.xml index 832a95934f..10d1e112dd 100644 --- a/helpdesk_mgmt/views/helpdesk_ticket_templates.xml +++ b/helpdesk_mgmt/views/helpdesk_ticket_templates.xml @@ -298,15 +298,13 @@ for="attachment" >Add Attachments