This Odoo technical development blog is my way to contribute back to the Odoo Community, for all the selfless and great sharing by the community members.
For many businesses, Odoo report such as Invoice, Purchase Order, Delivery Order and Sales Quotation, often required to have a physical signature at the bottom of the last page only. This requirement cannot be done easily in the standard Qweb framework.
Luckily, this can be achieved by using the following free OCA module report_qweb_element_page_visibility, with div class="last-page".
You will have to overwrite the footer (div class="footer") of the report and only display the signature at the last page (div class="last-page"). See the snippet below.
Click "Like" at the bottom of this blog, to motivate us to continue sharing more Odoo tips.
<xpath expr="//p[@t-field='o.notes']" position="after">
<div class="footer">
<div class="last-page" style="position:relative;font-size:12px;margin-top:0;">
<table>
<tr>
<td style="line-height: 1.6;" width="75%">
<strong>Prepared By</strong>
<br/><br/><br/><br/> <br/>
...................................................................
<br/> <br/>
</td>
<td style="text-align:left" width="25%">
<strong>Approved By</strong>
<br/><br/><br/><br/> <br/>
...................................................................
<br/>
<br/>
</td>
</tr>
</table>
</div>
<div class="text-center" style="border-top: 1px solid black;font-family:arial;font-size:8pt;">
<ul class="list-inline mb4">
<li t-if="o.company_id.phone" class="list-inline-item">Phone: <span t-field="o.company_id.phone"/></li>
<b>·</b>  
<li t-if="o.company_id.fax" class="list-inline-item">Fax : <span t-field="o.company_id.fax"/></li>
<b>·</b>  
<li t-if="o.company_id.email" class="list-inline-item">Email: <span t-field="o.company_id.email"/></li>
<b>·</b>  
<li t-if="o.company_id.website" class="list-inline-item">Website: <span t-field="o.company_id.website"/></li>
</ul>
<div name="financial_infos">
<span t-field="o.company_id.report_footer"/>
</div>
<div t-if="report_type == 'pdf'" class="text-muted">
Page: <span class="page"/> / <span class="topage"/>
</div>
</div>
</div>
</xpath>
You will also need to change the paper format of the report to give more margin at the bottom page (margin_bottom)
Remember to change the record id to the standard report id.
<record id="report_qweb_paperformat_po" model="report.paperformat">
<field name="name">PO report qweb paperformat</field>
<field name="default" eval="True"/>
<field name="format">A4</field>
<field name="orientation">Portrait</field>
<field name="margin_top">32</field>
<field name="margin_bottom">45</field>
<field name="margin_left">5</field>
<field name="margin_right">5</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">28</field>
<field name="dpi">90</field>
</record>
<record id="purchase.action_report_purchase_order" model="ir.actions.report">
<field name="paperformat_id" ref="report_qweb_paperformat_po"/>
</record>
Comments