如何在openerp中隐藏某个模块的qweb报表中的字段?

2024-05-13 22:15:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在自定义销售模块,因为我在销售订单窗体视图中隐藏了一些字段。当我去打印发票时,它会显示一些空字段,这些字段是我已经在表单视图中隐藏的。在

所以我想把那些字段隐藏在报表中。方法是什么,有什么想法吗??在

Reference:
Sales/Quotations/ print : sale.report_saleorder.pdf

在这方面,我想隐藏税收领域。在


Tags: 模块方法订单report视图表单报表窗体
2条回答

您可以在报表中隐藏所需的字段,方法与在窗体视图中几乎相同。在views文件夹中创建一个XML文件并将其添加到__openerp__.py。按以下方式启动文件:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="report_saleorder_document_customized" inherit_id="sale.report_saleorder_document">
        ...

从这里开始,您必须使用xpath标记来定位项目,并使它们不可见,方法与在简单表单视图中一样(使用position="attributes"/"replace")。在

敬上。在

您可以使用下面的代码隐藏qweb报表中的某些部分。在

在这里,我想隐藏税务表和更改后的字符串值,并隐藏Inovice报表的付款条件。在

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <template id="report_invoice_document_inherit" inherit_id="account.report_invoice_documnet">
            <!  Changed 'Draft Invoice' to 'Tax Invoice' and 'Invoice' to 'Tax Invoice' >
            <xpath expr="//div[@class='page']/h2/span[1]" position="replace">
                <span t-if="o.type == 'out_invoice' and (o.state in ('draft', 'open', 'paid'))">Tax Invoice</span>
            </xpath>
            <!  Hide span  >
            <xpath expr="//div[@class='page']/h2/span[3]" position="replace"/>
            <! Hide Tax table  >
            <xpath expr="//div[@class='page']/div[4]" position="attributes">
                <attribute name="class">hidden</attribute>
            </xpath>

            <!  Hide payment term value from invoice report  >
            <xpath expr="//div[@class='page']/p[2]" position="attributes">
                <attribute name="class">hidden</attribute>
            </xpath>
        </template>
    </data>
</odoo>

希望以上代码对您有所帮助。在

非常感谢

安基特甘地。在

相关问题 更多 >