İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
22303 Görünümler

I am working with qweb reports in odoo 10 . Here is what i did

<odoo>
<template id="report_customer">
    <t t-call="report.html_container">
        <t t-set="data_report_margin_top" t-value="50"/>
        <t t-foreach="range(5)" t-as="1">
            <t t-foreach="docs" t-as="o">
            <t t-call="report.internal_layout">
                <div class="page example-css-class">
                    <h2>Report title</h2>
                    <p>This object's name is
                        <span t-field="o.full_name"/>
                    </p>
                    <ul class="list-inline">
                         <li>Page:</li>
                         <li><span class="page"/></li>
                         <li>/</li>
                         <li><span class="topage"/></li>
                    </ul>
                </div>
            </t>
        </t>
        </t>
    </t>
</template>
</odoo>

and i also tried this

<odoo>
<template id="report_customer">
    <t t-call="report.html_container">
        <t t-set="data_report_margin_top" t-value="50"/>
        <t t-foreach="range(5)" t-as="1">
            <t t-foreach="docs" t-as="o">
            <t t-call="report.internal_layout">
                <div class="page example-css-class">
                    <h2>Report title</h2>
                    <p>This object's name is
                        <span t-field="o.full_name"/>
                    </p>
                    <div class="footer" style="text-align: center !important;">
                      Page  <span class="page"/> of <span class="topage"/>
                    </div>
                </div>
            </t>
        </t>
        </t>
    </t>
</template>
</odoo>

but in both cases i am not able to see page numbers. I also tried adding custom header and footer in separate templates but that also doesn't work.

Avatar
Vazgeç

you can call <t t-call="report.external_layout_footer" /> on your custom template right? or what is the actual problem, Whether the Page is printed on sheet? if not then it could be your css problem

En İyi Yanıt

HI,

try this because it works in my custom qweb report,

in your case, you should place <div class="footer"> after complete <div class="page" >.

<t t-call="report.external_layout">

    <div class="page" >

                page content whatever you print in Body Part or Report ... 

    </div

<div class="footer">

    <div class="row" style="font-size:8;">

        <div class="col-xs-6 text-left">

              <span t-esc="time.strftime('%Y-%m-%d %H:%M:%S')"/>

        </div>

        <div class="col-xs-6 text-right">

             Page <span class="page"/> of <span class="topage"/>

        </div>

    </div>

</div>

</t>

Thanks

Avatar
Vazgeç
En İyi Yanıt

Remember the page number only shows when the report type is PDF, In HTML format page number will not shown. Here we will display page number in this (page X of Y) format. In my case I am not using external_layout_footer in my reports. I instead have using footer class (class="footer").

<!--Report Body Section Goes Here-->
<div class="footer" style="position:absolute; margin:0px; padding:0px">
<span class="page"/>/<span class="topage"/>
</div>

You can check more details of show page numbers in qweb report: http://learnopenerp.blogspot.com/2017/11/how-to-add-page-number-in-qweb-reports.html



Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Şub 22
1758
0
Kas 18
4997
0
Şub 23
2084
3
Ağu 19
12777
2
Ara 18
13033