Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5 Trả lời
27212 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

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>

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Jusab,

Thanks for your tip.

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

Thanks once again.

Yogesh

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 25
1080
1
thg 7 25
22546
3
thg 1 25
3917
0
thg 1 24
1600
0
thg 1 24
1288