Skip to Content
Menu
This question has been flagged
3 Replies
21141 Views

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
Discard

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

Best Answer

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
0
Feb 22
1389
0
Nov 18
4445
0
Feb 23
1590
3
Aug 19
12168
2
Dec 18
12505