Skip to Content
Menu
This question has been flagged
3 Replies
6636 Views

Hello everyone,

I am customizing some reports in Odoo but I have encountered a problem for some time that I can not find the solution.

In fact, on all my reports the footers do not appear and the header appears only on the first page and not on the rest, I tried several solutions that I found on the net but without success.

I work on odoo 11 Enterprise version, Ubuntu 16.04, wkhtmltopdf 0.12.2.4-1, wkhtmltox 0.12.1.

Thank you for helping me

Avatar
Discard
Author Best Answer

Hello Daniel John,

here is my code, hope it will help you

<?xml version="1.0" encoding="utf-8"?>

<odoo>

<!-- Format paper -->

<record id="paperformat_purchasepo_radiocom" model="report.paperformat">

<field name="name">European A4 Purchase PO Radiocom</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">1</field>

<field name="margin_bottom">29</field>

<field name="margin_left">7</field>

<field name="margin_right">7</field>

<field name="header_line" eval="False"/>

<field name="header_spacing">10</field>

<field name="dpi">90</field>

</record>

<!-- Private templates used internally by reports -->

<!-- LAYOUT -->

<template id="layout" name="Report layout">&lt;!DOCTYPE html&gt;

<html t-att-lang="lang and lang.replace('_', '-')"

t-att-data-editable="'1' if editable else None"

t-att-data-translatable="'1' if translatable else None"

t-att-data-edit_translations="'1' if edit_translations else None"

t-att-data-main-object="repr(main_object) if editable else None"

t-att-data-report-margin-top="data_report_margin_top"

t-att-data-report-header-spacing="data_report_header_spacing"

t-att-data-report-dpi="data_report_dpi">

<head>

<meta charset="utf-8" />

<meta name="viewport" content="initial-scale=1"/>

<title><t t-esc="title or 'Odoo Report'"/></title>

<!--t t-call-assets="report.assets_common"/>

<t t-if="editable">

<t t-call-assets="web_editor.assets_editor"/>

<t t-call-assets="report.assets_editor"/>

</t-->

</head>

<body class="container" t-att-style="editable and 'margin-top: 40px;'">

<div id="wrapwrap">

<main>

<t t-raw="0"/>

</main>

</div>

</body>

</html>

</template>

<!-- HTML CONTAINER -->

<template id="html_container">

<t t-set="body_classname" t-value="'container'"/>

<t t-call="purchase_customize.layout">

<t t-raw="0"/>

</t>

</template>

<!-- EXTERNAL LAYOUT -->

<template id="external_layout">

<!-- Multicompany -->

<t t-if="o and 'company_id' in o">

<t t-set="company" t-value="o.company_id"></t>

</t>

<t t-if="not o or not 'company_id' in o">

<t t-set="company" t-value="res_company"></t>

</t>

<!--t t-call="purchase_customize.external_layout_header" /-->

<div class="article o_report_layout_boxed">

<t t-raw="0" />

</div>

<t t-call="purchase_customize.external_layout_footer" />

</template>

<!-- FOOTER -->

<template id="external_layout_footer">

<div class="footer">

<div class="text-center" style="border-top:1px dotted #000000">

<ul class="list-inline mb4">

<li t-if="company.street"><span t-field="company.street"/></li>

</ul>

<ul class="list-inline mb4">

<li t-if="company.phone">Phone: <span t-field="company.phone"/></li>

<li t-if="company.email">Email: <span t-field="company.email"/></li>

<li t-if="company.website">Web: <span t-field="company.website"/></li>

<li t-if="company.vat"><t t-esc="company.country_id.vat_label or 'TIN'"/>: <span t-field="company.vat"/></li>

</ul>

<div name="financial_infos">

<span t-field="company.report_footer"/>

</div>

<div class="text-muted">

Page: <span class="page"/> / <span class="topage"/>

</div>

</div>

</div>

</template>

<report

string="Purchase Order"

id="action_report_purchase_order_an"

model="purchase.order"

report_type="qweb-pdf"

name="purchase_customize.report_purchaseorderan_customise"

file="purchase_customize.report_purchaseorderan_customise"

paperformat="purchase_customize.paperformat_purchasepo_radiocom"

print_report_name="

(object.state in ('draft', 'sent') and 'Request for Quotation - %s' % (object.name) or

'English Purchase Order - %s' % (object.name))"

/>

<!-- Purchase Order Anglais -->

<template id="report_purchaseorderan_document_customise">

<t t-call="purchase_customize.external_layout">

<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/>

<style type="text/css">

header{

height:10px;

}

.page{

font-size:16px !important;

color:#000000 !important;

font-family: Arial, Helvetica, sans-serif !important;

}

#contenant{

font-size:16px !important;

}

.table tr td{

color:#000000 !important;

}

#tabheader tr td{

color:#000000 !important;

}

</style>

<div class="header">

</div>

<div class="page" width="150%" id="contenant">

<table class="table table-condensed" border-collapse="0px;" style="height:1200px;">

<thead>

<tr>

<td t-att-colspan="6" style="border:1px solid #ffffff !important;border-bottom:2px solid #1d0296 !important;">

<center>

<img t-if="o.company_id.logo" t-att-src="'data:image/png;base64,%s' % to_text(o.company_id.logo)" style="height: 75px;" width="400px"/>

</center>

</td>

</tr>

<tr>

<th class="text-left" t-att-colspan="3" style="border:1px solid #ffffff !important;padding-top:3px !important;vertical-align:top;">

<br/><strong></strong>

<strong><span t-field="o.company_id.partner_id"

t-options='{"widget": "contact", "fields": ["name"], "no_marker": True}'/>

</strong>

<ul class="list-block" style="list-style-type: none !important;font-weight:normal !important;">

<li><span t-field="o.company_id.street"/></li>

<li><span t-field="o.company_id.street2"/>, <span t-field="o.company_id.city"/>,

<span t-field="o.company_id.country_id"/></li>

<li>Tel.: <span t-field="o.company_id.phone"/></li>

<li>CD/KIN/RCCM/14-B-3454, ID.NAT.01-73-N 32550 T Numero Impot: A0700120P</li>

</ul>

</th>

<th class="text-left" t-att-colspan="3" style="border:1px solid #ffffff !important;padding-top:3px !important;vertical-align:top;">

<strong>Supplier:</strong>

<br/><span t-field="o.partner_id"

t-options='{"widget": "contact", "fields": ["name"], "no_marker": True}'/>

<ul class="list-block" style="list-style-type: none !important;font-weight:normal !important;">

<li><span t-field="o.partner_id.street"/></li>

<li><span t-field="o.partner_id.street2"/>, <span t-field="o.partner_id.city"/>,

<span t-field="o.partner_id.country_id"/></li>

<li>Tel.: <span t-field="o.partner_id.mobile"/></li>

</ul>

</th>

</tr>

<tr>

<th class="text-left" t-att-colspan="6" style="border:1px solid #ffffff !important;">

<p>Shipping address:</p>

</th>

</tr>

<tr>

<th class="text-left" t-att-colspan="6" style="border:1px solid #ffffff !important;">

<center>

<h3> Purchase Order Confirmation No. - : <span t-field="o.name"/></h3>

</center>

</th>

</tr>

<tr>

<th class="text-center" style="border:1px solid #ffffff !important;border-bottom:1px solid #000000 !important;">

<span><strong style="padding:2px;text-align:center;">Our Order Reference:</strong><br/><p style="font-weight:normal !important;" t-field="o.name"/></span>

</th>

<th class="text-center" style="border:1px solid #ffffff !important;border-bottom:1px solid #000000 !important;" t-att-colspan="3">

<span><strong style="padding:2px;">our Order Reference:</strong><br/><p style="font-weight:normal !important;" t-field="o.partner_ref"/></span>

</th>

<th class="text-center" style="border:1px solid #ffffff !important;border-bottom:1px solid #000000 !important;" t-att-colspan="2">

<span><strong style="padding:2px;">Order Date:</strong>

<p style="font-weight:normal !important; text-align:center;" t-field="o.date_order" t-field-options='{"format": "d/M/y"}'/></span>

</th>

</tr>

<tr>

<th class="text-center" style="border:1px solid #000000 !important;">Description</th>

<th class="text-center" style="border:1px solid #000000 !important;">Date Req. </th>

<th class="text-center" style="border:1px solid #000000 !important;">Qty</th>

<th class="text-center" style="border:1px solid #000000 !important;">Unit Price</th>

<th class="text-center" style="border:1px solid #000000 !important;">Taxes</th>

<th class="text-center" style="border:1px solid #000000 !important;">Amount</th>

</tr>

</thead>

<tbody>

<tr t-foreach="o.order_line" t-as="line">

<td>

<strong><span t-field="line.name"/></strong>

</td>

<td class="text-center">

<span t-field="line.date_planned" t-field-options='{"format": "d/M/y"}'/>

</td>

<td class="text-right">

<span t-field="line.product_qty"/>

<span t-field="line.product_uom.name" groups="product.group_uom"/>

</td>

<td class="text-right">

<span t-field="line.price_unit"/>

</td>

<td>

<span t-esc="', '.join(map(lambda x: x.name, line.taxes_id))"/>

</td>

<td class="text-right" style="background-color: transparent !important;">

<span t-field="line.price_subtotal"

t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>

</td>

</tr>

</tbody>

<tbody>

<tr>

<td t-att-colspan="6" style="background-color: transparent !important;">

<table width="100%">

<tr>

<td style="border:1px solid #ffffff;" width="65%">

<p style="padding:5px"><strong>Amount in Word: </strong>

<span t-field="o.amount_letter"/></p>

</td>

<td style="background-color: transparent !important;border:1px solid #ffffff;" width="35%">

<table class="table table-condensed" style="min-width:200px;max-width: 350px;">

<tr>

<td class="text-left" style="border:1px solid #000000 !important;"><strong>Subtotal</strong></td>

<td class="text-right" style="background-color: transparent !important;border:1px solid #000000 !important;">

<span t-field="o.amount_untaxed"

t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>

</td>

</tr>

<tr>

<td>Taxes</td>

<td class="text-right" style="background-color: transparent !important;border:1px solid #000000 !important;">

<span t-field="o.amount_tax"

t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>

</td>

</tr>

<tr>

<td style="background-color: transparent !important;border:1px solid #000000 !important;"><strong>Total</strong></td>

<td class="text-right" style="background-color: transparent !important;border:1px solid #000000 !important;">

<span t-field="o.amount_total"

t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>

</td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

</tbody>

<tfooter style="border:1px solid #ffffff !important;">

<tr>

<td t-att-colspan="6" style="background-color: transparent !important;">

<p style="text-align:left;">Select please</p>

<div class="col-xs-12">

<div class="col-xs-8">

<div class="col-xs-3">

<strong>ETA:</strong><br/>

<span>Date:</span>

<p t-field="o.date1" t-field-options='{"format": "d/M/y"}'/>

</div>

<div class="col-xs-3">

<strong>Transport:</strong><br/>

<span>By Air:</span>

<p t-field="o.byair"/>

</div>

<div class="col-xs-2">

<strong>Inspection:</strong><br/>

<span>Yes:</span>

<p t-field="o.yes"/>

</div>

</div>

<div class="col-xs-4">

<p style="padding:5px;text-align:right"><strong>

<em>Stamp &amp; Signature</em>

</strong></p>

</div>

<div class="col-xs-8" style="float:left;">

<div class="col-xs-3">

<span>Date:</span>

<p t-field="o.date1" t-field-options='{"format": "d/M/y"}'/>

</div>

<div class="col-xs-3">

<span>By Sea:</span>

<p t-field="o.bysea"/>

</div>

<div class="col-xs-2">

<span>No:</span>

<p t-field="o.yes"/>

</div>

</div>

<div class="col-xs-4">

<p style="padding:5px;text-align:right"/>

</div>

<div class="col-xs-8" style="float:left;padding-left:20px;">

<p style="padding:5px;text-align:left">

<strong>Forwarder name:</strong>

<span t-field="o.forwarder"/>

<br/><br/>

</p>

</div>

<div class="col-xs-4">

<p style="padding:5px;text-align:right">

<strong>Order Approved</strong>

<br/><br/>

</p>

</div>

</div>

<p t-field="o.notes"/>

</td>

</tr>

</tfooter>

</table>

<div class="oe_structure"/>

</div>

</t>

</template>

<template id="report_purchaseorderan_customise">

<t t-call="purchase_customize.html_container">

<t t-foreach="docs" t-as="o">

<t t-call="purchase_customize.report_purchaseorderan_document_customise" t-lang="o.partner_id.lang"/>

</t>

</t>

</template>

</odoo>

Avatar
Discard
Best Answer

Hello ,

Call external layout i hope it's help you .

<template id="Sales.report_xyz_document">

<t t-call="report.external_layout">

Inside your code

</t>

</template>

Avatar
Discard
Best Answer

Provide your code so we can have a look to provide help

Avatar
Discard