xml - 我是 Odoo 的新手,如果订单行中没有税,任何人都可以帮助我从报告中消失税,否则将显示税列
问题描述
<template id="testReport" inherit_id="sale.report_saleorder_document">
<t t-foreach="doc.order_line" t-as="line">
<xpath expr="//th[@name='th_taxes']" position="replace">
<th t-if="line.tax_id"></th>
</xpath>
</t>
</template>
如果 tax_id 存在,继承销售报告并执行条件不做任何其他事情
解决方案
<template id="testReport" inherit_id="sale.report_saleorder_document">
<t t-set="has_tax" t-value="doc.order_line.mapped('tax_id')"/>
<t t-foreach="doc.order_line" t-as="line">
<xpath expr="//th[@name='th_taxes']" position="replace">
<th t-if="has_tax"></th>
</xpath>
</t>
</template>
推荐阅读
- wpf - 将图像缩放到适当的大小,但具有最大宽度/高度
- python - 更快地解析 BigQuery JSON 结果
- c# - 如何将 DataGridView 单元格中的用户输入从点更改为逗号?
- jsf-2 - 如何更改 httpservlet 的行为以在 adf 中使用 doPost?
- python - 下载多个 PDF 时出现问题
- node.js - 带有 passport.js 的域和子域的 Cookie
- kernel - 如何在 Yocto 的内核中添加更改的 dts 文件?
- scala - Akka Streams 递归流调用
- intellij-idea - 为什么我的 Intellij Ultimate 检测不到 virtualenv?
- php - XML更新后PHP中的MYSQL事件