我正在自定义销售模块,因为我从销售订单表格视图中隐藏了一些字段。当我去打印发票时,它会显示一些我已经隐藏在表单视图中的空白字段。
所以我想让这些字段也隐藏在报告中。这样做的方法是什么,有什么想法吗?
Reference:
Sales/Quotations/ print : sale.report_saleorder.pdf
在那,我想隐藏税收字段。
您可以使用以下代码隐藏 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>
希望以上代码对您有所帮助。
最好的感谢,
安基特 H 甘地。
您可以在报表中隐藏您想要的那些字段,几乎与您在表单视图中所做的相同。在 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"
)。
问候。