Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
2997 Представления

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

Аватар
Отменить
Автор Лучший ответ

I will close this issue since I found another way to do what I needed.

When creating the 'ir.attachment' I set the 'res_id' to the previously created ticket ID, so that the attachment can be seen in the the attachment tab of the 'helpdesk.ticket'.

Аватар
Отменить
Лучший ответ

I have PDF files of prior employee payslips on a CD. I'd like to import these into OpenERP as attachments for each employee. In addition, I'd like to submit more files each month. To do this, I intend to develop a particular module/addon or a Python program that will access OpenERp through XML-RPC.

Аватар
Отменить

Does anyone have a solution for this https://dino-game.org problem?

Related Posts Ответы Просмотры Активность
2
сент. 22
3994
1
янв. 23
1895
2
мая 18
6282
0
июл. 17
2395
1
авг. 20
3440