Search code examples
templatesheaderodooreportfooter

How do I remove the header from reports in Odoo?


I want to remove the header and footer from my report in Odoo. I tried changing the layout to both basic and external layouts, but I had no success. How can I achieve this, please?

And how can I use paper format ?


Solution

  • You can use the basic report layout:

    Example:

    <template id="MODULE.report_no_hf">
        <t t-call="web.html_container">
            <t t-foreach="docs" t-as="doc">
                <t t-call="web.basic_layout">
                    <t t-call="MODULE.report_document" />
                </t>
            </t>
        </t>
    </template>
    

    To adjust the report spacing, create a custom paper format:

    <record id="paperformat_no_hf" model="report.paperformat">
        <field name="margin_top">0</field>
        <field name="margin_bottom">0</field>
        ...
    </record>
    

    And link it to the report action:

    <record id="action_report_no_hf" model="ir.actions.report">
        <field name="paperformat_id" ref="MODULE.paperformat_no_hf"/>
        ...
    </record>