【问题标题】:print many2many fields on qweb-report在 qweb-report 上打印 many2many 字段
【发布时间】:2018-02-23 23:27:51
【问题描述】:

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

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

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"/>

但我只得到这个

【问题讨论】:

    标签: python xml python-2.7 odoo-10 qweb


    【解决方案1】:

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

    试试下面的代码:

    <tr t-foreach="o.many2many_field" t-as="l">
       <td>
           <span t-field="l.name"/>
       </td>
    </tr>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多