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

Hi,

I want to develop custom header for only one report ,so write code
on same report file .
but problem is that my page content hide behind header
i have tried all method like padding,margin,

first page is comes good but again second page hide behind the header

here is my code.
​<odoo>

<record id="paperformat_sale" model="report.paperformat">
<field name="name">Purchase order</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">35</field>
<field name="margin_bottom">1</field>
<field name="margin_left">10</field>
<field name="margin_right">10</field>
<field name="header_line" eval="True"/>
<field name="header_spacing">20</field>
<field name="dpi">90</field>
</record>

<template id="report_saleorder_document_custom">
<t t-set="company" t-value="doc.company_id"></t>
<t t-set="partner" t-value="doc.partner_id"></t>
<div class="header" style="border:2px solid #000;">
<div class="row">
<div class="col-3 mb4">
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" style="max-height: 45px;" alt="Logo"/>
</div>
<div class="col-9 text-right" style="margin-top:22px;" t-field="company.report_header" name="moto"/>
</div>
<div t-if="company.logo or company.report_header" class="row zero_min_height">
<div class="col-12">
<div style="border-bottom: 1px solid black;"/>
</div>
</div>
<div class="row">
<div class="col-4">
<span t-field="company.partner_id"
t-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": true}"/>
<span t-field='company.vat'/><br/>
<span t-field='company.phone'/><br/>
<span t-field='company.email'/><br/>
<span t-field='company.l10n_it_address_send_fatturapa'/>
</div>
<div class="col-4">
<span t-field="doc.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<span t-field='partner.vat'/><br/>
<span t-field='partner.phone'/><br/>
<span t-field='partner.email'/><br/>
<span t-field='partner.pec_mail'/>
</div>
<div class="col-4">
<span t-field="doc.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<span t-field='partner.vat'/><br/>
<span t-field='partner.phone'/><br/>
<span t-field='partner.email'/><br/>
<span t-field='partner.pec_mail'/>
</div>
</div>

<div class="row" style='background-color:#D0D3D4;'>
<div class="col-12" style='border:1px solid #808B96;border-collapse:collapse;text-align:center;'>ORDER CONFIRMATION - Page 1 of TOT PAGINE</div>
</div>
<div class="row" style='background-color:#D0D3D4;'>
<div class="col-12">
<div class="col-2" style='border:1px solid #808B96;border-collapse:collapse;'>VS ORDER OF</div>
<div class="col-2" style='border:1px solid #808B96;border-collapse:collapse;'>09-SET-19</div>
<div class="col-2" style='border:1px solid #808B96;border-collapse:collapse; white-space:nowrap;'>NO.CONFIRMATION</div>
<div class="col-2" style='border:1px solid #808B96;border-collapse:collapse;'><span t-field='doc.name'/></div>
<div class="col-2" style='border:1px solid #808B96;border-collapse:collapse;'>ORDER CONFIRMATION DATE</div>
<div class="col-2" style='border:1px solid #808B96;border-collapse:collapse;'><span t-field='doc.confirmation_date'></span></div>
</div>
</div>
<div class="row" style='background-color:#D0D3D4;'>
<div class="col-12">
<div class="col-6" style='border:1px solid #808B96;border-collapse:collapse;'>PAYMENTS</div>
<div class="col-6" style='border:1px solid #808B96;border-collapse:collapse;'><span t-field="doc.payment_term_id"></span></div>
</div>
</div>
</div>
<!-- <div class="container-fluid"> -->
<!-- Is there a discount on at least one line? -->
<!-- <t t-set="display_discount" t-value="any([l.discount for l in doc.order_line])"/> -->
<div class="page" style='border:4px solid red;padding-top:40%'>
<div class="row col-12" >
<table class="table table-sm o_main_table">
<thead style='border:1px solid black; border-collapse: collapse;'>
<tr>
<!-- TODO: remove in master -->
<!-- <t t-set="colspan" t-value="5"/> -->
<th style='border:1px solid #808B96;border-collapse:collapse;'>Product image</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Ext code</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Description</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Quantity</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Unit Price</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>From size</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>To size</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Assortment</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Pairs for size</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Total pair</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Taxes</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Total Price</th>
</tr>
</thead>
<t t-foreach="doc.order_line" t-as="line">
<tbody>

<tr>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<img t-attf-src="data:image/*;base64,{{line.product_id.image}}" style="height:50px;width:80px"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.external_code"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.name"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.product_uom_qty"/>
<span t-field="line.product_uom" groups="uom.group_uom"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.price_unit"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.range_start"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.range_end"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.assortment_id.code"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;
word-break: break-all;'>
<span t-field="line.pairs_size"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.pairs_total"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.tax_id"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="line.tax_id"/>
</td>

</tr>

</tbody>
</t>

</table>
</div>
<div class="row col-12" >
<table class="table table-sm o_main_table" style='border:1px solid #808B96; border-collapse: collapse;' align="center" cellpadding='5'>
<thead style='border:1px solid black; border-collapse: collapse;'>
<tr>
<th style='border:1px solid #808B96;border-collapse:collapse;'>VAT on products %</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>VAT on products €</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Total Order</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Cost Transport</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>VAT its transport %</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>VAT on transport €</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Total transport</th>
<th style='border:1px solid #808B96;border-collapse:collapse;'>Total balance</th>
</tr>
</thead>
<tbody style='text-align:center;'>
<tr>
<td style='border:1px solid #808B96;border-collapse:collapse;'>⁣</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="doc.amount_tax"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="doc.amount_untaxed"/>
</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>⁣</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>⁣</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>⁣</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>⁣</td>
<td style='border:1px solid #808B96;border-collapse:collapse;'>
<span t-field="doc.amount_total"/></td>
</tr>
<tr>
<td nowrap='' style='border:1px solid white;'>⁣</td>
</tr>
</tbody>
</table>
</div>
<div class="row col-12" >
<table class="table table-sm o_main_table" style="border:1px solid #808B96;border-bottom:1px solid white; border-collapse: collapse;">
<tbody>
<tr>
<td class='col-lg-4'>
For acceptance <br/>Stamp and customer signature
</td>
<td class='col-lg-4'>

</td>
<td class='col-lg-4'>

</td>
</tr>
</tbody>
</table>
</div>
<!-- </div> -->
</div>


<!-- </t> -->
</template>


<template id="report_saleorder_custom">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="stock_mgmt.report_saleorder_document_custom"/>
</t>
</t>
</template>

Thanks

Avatar
Discard

Assign a paperformat for the report, and try by adjusting top margin and header space in the paperformat

Best Answer

If you set the margin top: 0 in  the paper format, the default header will be hidden and you can use your's.

Avatar
Discard