Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
5 Replies
27188 Tampilan

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

Avatar
Buang
Jawaban Terbai

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

Avatar
Buang

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

Jawaban Terbai

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>

Avatar
Buang
Penulis Jawaban Terbai

Jusab,

Thanks for your tip.

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

Thanks once again.

Yogesh

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Mar 25
1057
1
Jul 25
22532
3
Jan 25
3867
0
Jan 24
1589
0
Jan 24
1277