【问题标题】:(odoo10) how to add product attributes in pdf invoice(odoo10) 如何在pdf发票中添加产品属性
【发布时间】:2018-10-16 15:43:32
【问题描述】:

请建议如何将产品属性添加到 pdf 发票中。 目前我们打印产品SCU:

                    <tr t-foreach="o.invoice_line_ids" t-as="l">
                    <td><span t-field="l.product_id.default_code"/></td>
                    <td class="hidden"><span t-field="l.origin"/></td>
                    <td class="text-right">

发票上看起来有点难看。 请建议如何添加产品模板,如 l.product_id.name + 属性,如:

另外,您能否建议如何将属性放在产品名称下方? 这是我现在的代码:

        <tbody class="invoice_tbody">
            <tr t-foreach="o.invoice_line_ids" t-as="l">
                <td><span t-field="l.product_id.name"/></td>
                <t t-esc="', '.join(['%s: %s' % (attribute_value.attribute_id.name, attribute_value.name) for attribute_value in l.product_id.attribute_value_ids])"/>
                <td class="hidden"><span t-field="l.origin"/></td>

我想要这样: 非常感谢!

【问题讨论】:

  • 答案是一样的,只要这样使用:
  • 很好,非常感谢,已接受回答!
  • 请点赞,也有帮助

标签: pdf odoo odoo-10


【解决方案1】:

您需要执行以下操作来输出产品属性名称和值:

<t t-esc="', '.join(['%s: %s' % (attribute_value.attribute_id.name, attribute_value.name) for attribute_value in l.product_id.attribute_value_ids])"/>:

【讨论】:

  • Axel,非常感谢,这几乎是我所需要的,但您能否建议如何将属性放在产品名称下方?我将在 2 分钟内更新我最初的问题。
  • 这是位置问题,请参阅其他评论。但是你的问题的答案应该是贴出来的
猜你喜欢
  • 2012-12-18
  • 2019-06-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-04
  • 2017-06-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多