I am using qweb reports to generate a document which should have associated attachments using the document
module of Odoo. But I don't know how to display the list of attachments associated 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?
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)])