Hey team !
So here's the context, I'm using the 'helpdesk.ticket' thingy and a NodeJS library called 'odoo-await' that let me send XMLRPC request from a NodeJS app.
What I want to do is:
1. Create a new 'helpdesk.ticket'
2. Add a comment to the newly created ticket, I'm using the 'mail.message' model
3. I want that comment to have an attachment 'ir.attachment'
Right now I successfully created the ticket, the comment to that ticket and the orphan attachment.
My issue is that I'm not able to add the attachment to the 'mail.message' comment.
I first create the attachment so that I can use it's ids ('file_id') to put it in the 'attachment_ids' fields, and then create the comment with the code below :
await odoo.create('mail.message', {
model: 'helpdesk.ticket',
attachment_ids: [(6, 0, file_id)],
message_type: 'comment',
res_id: ticket_id
})
This code create the comment, and I tried multiple configuration for the 'attachment_ids' fields :
attachment_ids: [file_id]
attachment_ids: [(file_id)]
attachment_ids: [(0, file_id)]
attachment_ids: [[0, file_id]]
attachment_ids: [(6, 0, file_id)]
attachment_ids: [[6, 0, file_id]]
attachment_ids: [('6', '0', file_id)]
attachment_ids: [['6', '0', file_id]]
And also all these configurations with file_id as a String instead of an Int
No matter what I do in the end, when I check the new comment, the 'attachment_ids' field is always empty.
Any hints on what I'm doing wrong ?
I'm kinda lost on what the (6, 0, id) m2m represent, but I saw it in a bunch of other answer to similar issue.
I also tried reading the source code for mail.message, but yeah, python isn't really my thing...
Thanks everyone reading this.
Have a good day