在qweb-report上打印many2many字段

aya*_*yar 0 python xml python-2.7 qweb odoo-10

我想知道如何在报表qweb中打印很多很多字段,类似于销售模块的报价,发票中的内容。

或者,如果可以在报告中单独打印它们

销售报价

cie10_app模型

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')
Run Code Online (Sandbox Code Playgroud)

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')
Run Code Online (Sandbox Code Playgroud)

notify_app

from odoo import models, fields, api
class InfMed(models.Model):
    dx1 = fields.Many2many('info.cie10')
Run Code Online (Sandbox Code Playgroud)

我需要在报告qweb中打印整个字段many2many

通报的报告

<span t-field="o.tratRec1"/>
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

但我只有这个

在此处输入图片说明

小智 5

您需要使用for循环来打印many2many字段值。

尝试以下代码:

<tr t-foreach="o.many2many_field" t-as="l">
   <td>
       <span t-field="l.name"/>
   </td>
</tr>
Run Code Online (Sandbox Code Playgroud)