This question has been flagged
3 Replies
11036 Views

Hello gang!

I have now beautifull qweb report in PDF. But if my reports (sale order, for example) have more than one page, the header is on EACH page. 

How to put company header only on the first page?

Thanks

Avatar
Discard
Author

Somebody manage to do it? We still did not.

Author

May be an idea : the pseudo class :first-of-type in CSS?

Author Best Answer

Ref :
        http://lolierp.blogspot.ca/2015/03/odoo-8-editions-qweb-suppression-entete.html?showComment=1430604942124

It works here. We are very happy of this!

Look image, header is only on the first page of the saleorder!!!! Great



If somebody needs XML code, it will be a pleasure to put it here. Just ask.


UPDATE 7 AUGUST 2015 - SOME CODES TO HELP!

<template id="report_lapagept.report_header_pt">

<!--Ici l'en-tête de La Page PT-->

<div class="row zero_min_height">

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

<div style="border-bottom: 3px solid #881111;" />

</div>

</div>

<div class="row" style="">

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

<span>&nbsp;</span>

<img t-if="user.company_id.logo" t-att-src="'data:image/png;base64,%s' % user.company_id.logo" style="max-height: 60px; margin-left: 5px; margin-top: 5px;" /> </div>

<div class="col-xs-9 text-right" style="padding-top: 20px;">

<span style="font-size: 20px;" t-field="user.company_id.rml_header1" />

<span>&nbsp;&nbsp;</span>

</div>

</div>

<div class="row zero_min_height">

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

<div style="margin-top: 5px; border-bottom: 3px ridge #222222;" />

</div>

</div>

<div class="row">

<div style="margin-top: 5px;" class="col-xs-4">

<div t-field="user.company_id.partner_id" t-field-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": true}" style="padding-left: 5px; padding-bottom: 5px; border-bottom: 3px solid #555544;" />

</div>

<div style="margin-top: 5px; font-size: 10px;" class="col-xs-4">

<div>TPS : 85890 5656 RT0001</div>

<div>TVQ : 1028299113 TQ0002</div>

<div>TVD : 858905656 MT0001</div>

</div>

<div style="margin-top: 5px; font-size: 11px;" class="col-xs-4">

<div>NE : 858905656</div>

<div>NEQ : 2265894800</div>

</div>

</div>

</template>

 

<template id="report_saleorder_document_lapagept" inherit_id="sale.report_saleorder_document">

<xpath expr="//div[@class='page']" position="replace">

<div style="font-family: Ubuntu;" class="page">

<div t-if="user.company_id.x_company_prefix == 'AS'">

<t t-call="report_lapagept.report_header_as" />

</div>

<div t-if="user.company_id.x_company_prefix == 'PT'">

<t t-call="report_lapagept.report_header_pt" />

</div>

<div t-if="user.company_id.x_company_prefix == 'IV'">

<t t-call="report_lapagept.report_header_iv" />

</div>

<div class="oe_structure"/>

<div class="row">

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

<h4>

<strong t-if="o.partner_shipping_id == o.partner_invoice_id">Invoice and shipping address :</strong>

<strong t-if="o.partner_shipping_id != o.partner_invoice_id">Invoice address :</strong></h4>

<div style="margin-left: 20px;">

<div t-field="o.partner_invoice_id" t-field-options="{"widget": "contact","fields": ["address", "name", "phone", "fax"], "no_marker": true}"/>

<p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>

</div>

</div>

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

<div t-if="o.partner_shipping_id != o.partner_invoice_id" class="mt8">

<h4><strong>Shipping address :</strong></h4>

<div style="margin-left: 20px;">

<div t-field="o.partner_shipping_id" t-field-options="{"widget": "contact", "fields":

["address", "name", "phone", "fax"], "no_marker": true }"/>

<p t-if="o.partner_id.vat">VAT : <span t-field="o.partner_id.vat"/></p>

</div>

</div>

</div>

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

<h4><strong>Partner address : </strong></h4>

<div style="margin-left: 20px;">

<div t-field="o.partner_id" t-field-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": true}"/>

</div>

</div>

</div>

 

<h1>

<span t-if="o.state not in ['draft','sent']">Order : N° </span>

<span t-if="o.state in ['draft','sent']">Quotation : N° </span>

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

</h1>

<div class="row mt32 mb32" id="informations">

<div t-if="o.client_order_ref" class="col-xs-3">

<strong>Your reference :</strong>

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

</div>

<div t-if="o.date_order" class="col-xs-3">

<strong t-if="o.state not in ['draft','sent']">Date ordered :</strong>

<strong t-if="o.state in ['draft','sent']">Quotation date :</strong>

<div style="margin-left: 6px;">

<p t-field="o.date_order" t-field-options='{"format": "d MMMM y"}'/> </div>

</div>

<div t-if="o.user_id.name" class="col-xs-3">

<strong>Salesperson :</strong>

<div style="margin-left: 6px;">

<p t-field="o.user_id.name"/></div>

</div>

<div t-if="o.payment_term" class="col-xs-3">

<strong>Payment term :</strong>

<div style="margin-left: 6px;"><p t-field="o.payment_term"/></div>

</div>

</div>

<table class="table table-condensed">

<thead>

<tr>

<th> Picture</th>

<th>Name</th>

<th>Description</th>

<th>Taxes</th>

<th class="text-right">Quantity</th>

<th class="text-right">Unit price</th>

<th groups="sale.group_discount_per_so_line">Discount (%)</th>

<th class="text-right">Price</th>

</tr>

</thead>

<tbody class="sale_tbody">

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

<td>

<span t-field="l.product_id.image_small" t-field-options="{"widget": "image", "height": "64"}" />

</td>

<td>

<span t-field="l.product_id.name"/>

</td>

<td>

<span t-field="l.name"/>

</td>

<td>

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

</td>

<td class="text-right">

<span t-field="l.product_uom_qty"/>

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

</td>

<td class="text-right">

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

</td>

<td groups="sale.group_discount_per_so_line">

<span t-field="l.discount"/>

</td>

<td class="text-right">

<span t-field="l.price_subtotal" t-field-options="{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}"/>

</td>

</tr>

</tbody>

</table>

<div class="row">

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

<table class="table table-condensed">

<tr class="border-black">

<td><strong>Total without taxes</strong></td>

<td class="text-right">

<span t-field="o.amount_untaxed" t-field-options="{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}"/>

</td>

</tr>

<tr>

<td>Taxes</td>

<td class="text-right">

<span t-field="o.amount_tax" t-field-options="{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}"/>

</td>

</tr>

<tr class="border-black">

<td><strong>Total</strong></td>

<td class="text-right">

<span t-field="o.amount_total" t-field-options="{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}"/>

</td>

</tr>

</table>

</div>

</div>

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

<p t-if="o.payment_term.note">

<strong>Payment Term:</strong>

<span t-field="o.payment_term.note"/>

</p>

<div class="oe_structure"/>

</div>

</xpath>

</template>

</data>



Avatar
Discard

Any chance you could post other sample reports?

Author

Just say to me what you would want to see. No prob.

Hey Pascal is it possible to see some sample xml code ?