在qweb-report上打印many2many字段

问题描述 投票:0回答:1

我想知道如何在报告中打印qweb整个字段many2many,类似于销售模块的报价,发票中发生的情况。

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

sales quotation

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')

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')

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

informed_report

<span t-field="o.tratRec1"/>

enter image description here

但我只能得到这个

enter image description here

python xml python-2.7 odoo-10 qweb
1个回答
3
投票

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

尝试使用以下代码:

<tr t-foreach="o.many2many_field" t-as="l">
   <td>
       <span t-field="l.name"/>
   </td>
</tr>
© www.soinside.com 2019 - 2024. All rights reserved.