问题描述
我有一列“Untaxed Amount”,我希望“price”字段只有 1 个值,因为它是所有文章的总价,但我为每篇文章获取了这个值。在 .xml vue 中怎么可能只有 1 个该值的迭代
<t ...some code...
<td t-if="o.sale_id">
<span t-field="pack_operation.price"/> I want to have this only once in my table
</td>
</t>
有可能吗???
解决方法
如果您的意思是 pack_operation
是多条记录的记录集并且您需要总和,则可以使用
<span><t t-esc="sum(pack_operation.mapped('price'))" /></span>