0
votes

i am using qweb reports to generate a document wich should have asociated attachments using the document module of Odoo. But i dont know how to display the list of attachments asociated to a document in the qweb/pdf report.

Please note that i am not asking to store a document as attachment. Just to display the list of current attachments in a report.

Do you know how to do that?

1

1 Answers

0
votes

I solve that problem using computed fields in a relationship one2many.

this make the magic:

attachment_ids = fields.One2many(comodel_name="ir.attachment", inverse_name="res_id", compute="_add_attachment")
@api.multi
def _add_attachment(self):
    self.attachment_ids = self.env['ir.attachment'].search([('res_model','=','document'),('res_id','=',self.id)])