(odoo10) 如何在 pdf 发票中添加产品属性
(odoo10) how to add product attributes in pdf invoice
请教如何将产品属性添加到 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>
我想要这样:
非常感谢!
您需要执行类似这样的操作来输出产品属性名称和值:
<t t-esc="', '.join(['%s: %s' % (attribute_value.attribute_id.name, attribute_value.name) for attribute_value in l.product_id.attribute_value_ids])"/>:
请教如何将产品属性添加到 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>
我想要这样:
您需要执行类似这样的操作来输出产品属性名称和值:
<t t-esc="', '.join(['%s: %s' % (attribute_value.attribute_id.name, attribute_value.name) for attribute_value in l.product_id.attribute_value_ids])"/>: