【问题标题】:How to get the value of the selection field other than the key in q-web reports odoo 12?如何获取q-web报告odoo 12中除键以外的选择字段的值?
【发布时间】:2020-09-28 03:22:33
【问题描述】:

我有一个选择字段,例如

field = fields.Selection([('a', 'A'), ('b', 'B')],string='Test')

当我尝试在选择字段中获取所选元素时,键“a”正在打印到 pdf 中,我需要打印“A”

<t t-esc="med['field']"/> #med 是将模型 A 连接到 B 的 one2many 线,我正在尝试从模型 B(笔记本)中获取数据,

【问题讨论】:

标签: odoo-12 qweb


【解决方案1】:

我不知道旧版本,但至少在 Odoo 13.0 中,只需使用 t-field 而不是 t-esc,因此 Odoo 将为您获得正确的价值。简单例子:

<span t-field="med.field" />

【讨论】:

  • 是的,可能回到版本 9.0 或 8.0,但我没有检查它。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-21
  • 1970-01-01
  • 2020-11-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多