首页 > 解决方案 > 我是 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 存在,继承销售报告并执行条件不做任何其他事情

标签: xmlodoo

解决方案


<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>

推荐阅读