I would like to know how I can print in a report qweb a whole field many2many, similar to what happens in the quotes, invoices of the sales module.
Or if it is possible to print them separately in the report
cie10_app model
from odoo import models, api, fields
class Cie10Db(models.Model):
_name = 'cie10.list'
_rec_name = 'detalleCie'
codCie = fields.Char('Codigo Cie10')
detalleCie = fields.Char('Detalle Diagnostico')
cie10_informed
from odoo import models, fields
class DiagRec(models.Model):
_name = 'info.cie10'
ob_cie10 = fields.Many2one('cie10.list',string='Dx (CIE 10)')
ob_codCie10 = fields.Char(related='ob_cie10.codCie')
ob_observaciones = fields.Char('Observaciones')
informed_app
from odoo import models, fields, api
class InfMed(models.Model):
dx1 = fields.Many2many('info.cie10')
I need to print the whole field many2many in the report qweb
informed_report
<span t-field="o.tratRec1"/>
but I only get this
You need to use for loop to print many2many field value.
Try with following code:
<tr t-foreach="o.many2many_field" t-as="l">
<td>
<span t-field="l.name"/>
</td>
</tr>