Odoo Help

1

[SOLVED]QWeb Report - How to repeate first page header on each page when printing on a custome size paper?

By
Merlin TecSol Pvt. Ltd.
on 12/9/15, 12:17 AM 3,077 views

Hello,

I am trying to get QWeb to print the header that is printed on First page to repeat on each page.

We have built a custom report to print on a custome size page.

The size of paper is:

Width 4.1 inches X Height 5.5 inches.


How to achieve this?


TIA

Yogesh

3

Jusab Sida (jsi)

--Jusab Sida (jsi)--
Tiny ERP Pvt Ltd
http://www.odoo.com
908
| 2 2 5
Gandhinagar, India
--Jusab Sida (jsi)--


Jusab Sida (jsi)
On 12/9/15, 1:54 AM

Hi yogesh,

For the repetition of header you need to call your custom layout(Header/footer) before page.(report_extended/my_mrporder_report.xml)

<?xml version="1.0"?> <t t-name="report_extended.my_report_mrporder"> <t t-call="report.html_container"> <t t-foreach="docs" t-as="o"> <t t-call="report_extended.my_own_layout"><!-- This will repeat header/footer in each page-->

                <div class="page">
......

 Hope this will help you.

---------------------------edited for extra information

If you need to create your own layout, you can simply create it in your custom module.

Just put you layout code in your report file. like...(report_extended/my_mrporder_report.xml)

<template id="my_own_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="report_extended.my_own_layout_header"/>
<t t-raw="0" />
</template>
<template id="my_own_layout_header">
<div class="header">
<div class="row">
<h1>MY HEADER</h1>
</div>
</div>
</template>

Here report_extended is your custom module.

Do not hesitated to ask more... 

@Jusab Sida : Hello ! i'm facing same problem for creating custom header in qweb.Your suggestion is quite helpful.For this-->> "" I need to create another template("my_internal_layout") but can u pls suggest me how to create multiple templates in qweb. I read docs(QWeb)& other details from google,bt didn'tget as I needed.

PujaBaa Zala
on 12/9/15, 7:49 AM

I have edited my answer...

Jusab Sida (jsi)
on 12/11/15, 6:33 AM
0
shiva_guntuku
On 9/7/16, 2:20 AM

you can do in this way by inheriting template  "report.external_layout_header".

<template id="report_external_layout_demo" inherit_id="report.external_layout_header">

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

<div class="header">

<<<<your customer header or text >>>>>>

</div>

</xpath>

</template>

0

Jusab,

Thanks for your tip.

I will check it get back if I need more assistance.

Thanks once again.

Yogesh

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 12/9/15, 12:17 AM
Seen: 3077 times
Last updated: 9/7/16, 2:20 AM