如何隐藏openerp中某些模块的qweb报告中的字段?

问题描述 投票:0回答:2

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

所以我想在报告中隐藏这些字段。这样做的方法是什么,任何想法?

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

在那,我想隐藏税收字段。

python xml xpath openerp qweb
2个回答
1
投票

您可以在报表中隐藏所需的字段,就像在表单视图中一样。在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")。

问候。


1
投票

您可以使用以下代码隐藏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>

希望以上代码可以帮到你。

最好的谢谢,

Ankit:甘地

© www.soinside.com 2019 - 2024. All rights reserved.