mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 16:52:05 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
from odoo.http import request
|
||||
|
||||
from odoo.addons.mail.controllers.discuss import DiscussController
|
||||
|
||||
|
||||
class AttachmentController(DiscussController):
|
||||
def mail_attachment_upload(
|
||||
self, ufile, thread_id, thread_model, is_pending=False, **kwargs
|
||||
):
|
||||
response = super().mail_attachment_upload(
|
||||
ufile, thread_id, thread_model, is_pending=is_pending, **kwargs
|
||||
)
|
||||
attachment_id = response.json.get("id")
|
||||
if not attachment_id:
|
||||
return response
|
||||
# Update attachment data
|
||||
attachmentData = {**response.json}
|
||||
attachment = request.env["ir.attachment"].sudo().browse(attachment_id).exists()
|
||||
if attachment:
|
||||
attachmentData.update(**attachment.get_additional_data())
|
||||
return request.make_json_response(attachmentData)
|
||||
Loading…
Add table
Add a link
Reference in a new issue