Reputation: 2129
I am customizing Sales module as I have hidden some fields from sales order FORM VIEW. When I go for printing invoice its showing some empty fields those are which I've already made hide in form view.
So I want to make those fields hidden in reports also. What is the methodology to do so, any ideas??
Reference:
Sales/Quotations/ print : sale.report_saleorder.pdf
In that, I want to hide Taxes field.
Upvotes: 0
Views: 4754
Reputation: 656
You can use below code for hide some part in qweb report.
Here, I want to hide tax table and Changed string value and also hide payment term of Inovice report.
<?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>
Hope above code help you.
Best Thanks,
Ankit H Gandhi.
Upvotes: 2
Reputation: 10189
You can hide those fields you want in the report almost the same way you did in form view. Create a XML file in views folder and add it to __openerp__.py
. Start your file this way:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_saleorder_document_customized" inherit_id="sale.report_saleorder_document">
...
From here on you must use xpath
tag to locate your items, and make them invisible in the same way you do in a simple form view (using position="attributes"/"replace"
).
Regards.
Upvotes: 1