我正在尝试将供应商代码显示在采购订单上。
我能够显示,只要只有一个供应商与产品相关联,但如果还有更多,我会收到错误:Unexpected singleton
<xpath expr="//table[@class='table table-condensed']//tbody//tr" position="replace">
<td>
<span t-f="line.product_id.seller_ids.product_code"/>
</td>
</xpath>
如果产品上有超过2个供应商,是否有办法获取默认或第一个卖家代码?
答案 0 :(得分:1)
以下是使用和运算符的简单方法。
前:
<xpath expr="//table[@class='table table-condensed']//tbody//tr" position="replace">
<td>
<span t-field="line.product_id.seller_ids and line.product_id.seller_ids[0].product_code"/>
</td>
</xpath>