How to hide External Header in Odoo reports using XML

1.3k views Asked by At

I don't want the External Header that appears in all report pages to be displayed in all reports. For some reports I want to show the header and for others its should be hidden. Is there any way to add this functionality in Odoo via XML coding in the addons?

I don't want to comment the xml code under 'External Header' in the Odoo's User interface. I am using Odoo v10. I only want to hide the below section:

    <div class="row">
        <div class="col-xs-6" name="company_address">
            <span t-field="company.partner_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: true}" style="border-bottom: 1px solid black; display:inline-block;"/>
        </div>
    </div>

When I try to comment this code from the UI of Odoo , a blank space for the above section is left in the report.

2

There are 2 answers

0
Mahmoud Ramadan On

You Can Inherit any template by this way

<template id="report_header_custom" inherit_id="report.external_layout_header">
   <xpath expr="//div[@name='company_address']" position="replace">
         <div></div>
   </xpath>
      </template>
0
Mahmoud Ramadan On

or you can replace all header by this way:

<template id="report_header_custom" inherit_id="report.external_layout_header">
            <xpath expr="//div[@class='header']" position="replace">
                <div class="header">
                    <div class="row">
                        <div class="col-xs-3">
                            <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo"
                                 style="max-height: 45px;"/>
                        </div>

                        <div class="col-xs-9 text-right" style="margin-top:20px;" t-field="company.rml_header1"/>
                    </div>
                    <div class="row zero_min_height">
                        <div class="col-xs-12">
                            <div style="border-bottom: 1px solid black;"></div>
                        </div>
                    </div>

                </div>
            </xpath>
        </template>