Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
5 Răspunsuri
27219 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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... 

Imagine profil
Abandonează

@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.

I have edited my answer...

Hello,

I'm also facing the same problem for creating a custom header in qweb.

my half header was print with cut( i get cut half header), please help me.

Cel mai bun răspuns

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>

Imagine profil
Abandonează
Autor Cel mai bun răspuns

Jusab,

Thanks for your tip.

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

Thanks once again.

Yogesh

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
mar. 25
1085
1
iul. 25
22547
3
ian. 25
3951
0
ian. 24
1627
0
ian. 24
1320