This article will teach you how to repeat the header and footer on each page of the Odoo QWEB report. For example, if your report has 10 pages then each page has the same header and footer (without repeating the same code again and again).
How to repeat header and footer in QWEB custom Odoo Reports
To repeat the header and footer on each page of Odoo reports, just follow the below code snippet.
Read More: How to Add Page Number in QWEB Reports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<openerp> | |
<data> | |
<report | |
id="report_id_goes_here" | |
model="your.model" | |
string="Report Name Goes Here" | |
name="module_name.my_custom_report" | |
file="module_name.report_id_goes_here" | |
report_type="qweb-pdf" /> | |
<record id="paperformat_enoting" model="report.paperformat"> | |
<field name="name">Custom Paper Fromate for Report</field> | |
<field name="default" eval="True"/> | |
<field name="format">A4</field> | |
<field name="page_height">0</field> | |
<field name="page_width">0</field> | |
<field name="orientation">Portrait</field> | |
<field name="margin_top">62</field> | |
<field name="margin_bottom">12</field> | |
<field name="margin_left">7</field> | |
<field name="margin_right">7</field> | |
<field name="header_line" eval="False"/> | |
<field name="header_spacing">60</field> | |
<field name="dpi">96</field> | |
</record> | |
<record id="module_name.report_id_goes_here" model="ir.actions.report.xml"> | |
<field name="paperformat_id" ref="module_name.paperformat_enoting" /> | |
</record> | |
<template id="my_custom_report"> | |
<t t-call="report.html_container"> | |
<div class="header"> | |
<div class="row"> | |
<div> | |
</div> | |
</div> | |
</div> | |
<div class="page"> | |
<div class="row"> | |
</div> | |
</div> | |
<div class="footer"> | |
<div class="row"> | |
<p class="pull-left"><b>Printed By: </b><span t-esc="user.name"></span></p> | |
<p class="pull-right" ><b>Printed Date: </b><span t-esc="time.strftime('%d-%b-%Y')"></span></p> | |
<div align="center"> | |
<span class="page" />/<span class="topage" /> | |
</div> | |
</div> | |
</div> | |
</t> | |
</template> | |
</data> | |
</openerp> |
Read More: How to Create QWEB Custom Report in Odoo
0 Comments