Python 2.7 如何在报告销售订单中打印产品变体
我想打印变体产品,作为报告销售订单中产品的说明。为此,我添加了一个新标记th描述,并使用了span t-esc=“”,“.join([x.attribute\u id For x in o.order\u line.product\u id.product\u tmpl\u id.attribute\u line\u id])”/但它在求值时显示错误QWebException:“sequence item 0:expected string,product.attribute Founded”Python 2.7 如何在报告销售订单中打印产品变体,python-2.7,odoo-9,Python 2.7,Odoo 9,我想打印变体产品,作为报告销售订单中产品的说明。为此,我添加了一个新标记th描述,并使用了span t-esc=“”,“.join([x.attribute\u id For x in o.order\u line.product\u id.product\u tmpl\u id.attribute\u line\u id])”/但它在求值时显示错误QWebException:“sequence item 0:expected string,product.attribute Founded”
“,”.join([x.attribute\u id for x in doc.order\u line.product\u id.product\u tmpl\u id.attribute\u line\u id])”。是否需要帮助
<t t-foreach="doc.order_line" t-as="l">
<tr t-if="l.product_uom_qty">
<td>
<span t-field="l.product_id.name"/>
</td>
<td>
<span><t t-esc="', '.join([x.attribute for x in doc.order_line.product_id.product_tmpl_id.seller_ids])"/> </span>
</td>
<td>
<span t-field="l.product_id.default_code"/>
</td>
<td>
<span><t t-esc="', '.join([x.product_code for x in doc.order_line.product_id.product_tmpl_id.attribute_line_ids])"/> </span>
</td>
<td class="text-right">
<span t-field="l.product_uom_qty"/>
<span groups="product.group_uom" t-field="l.product_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td class="text-right">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), l.tax_id))"/>
</td>
</tr>
</t>
</tbody>
我找到了解决方案,而且很有效
<td>
<t t-foreach="l.product_id.attribute_line_ids" t-as="variant">
-<span t-field="variant.attribute_id"/>:
<span t-field="variant.value_ids.name"/>
</t>
</td>
-:
有什么帮助吗?