Se rendre au contenu
Menu
Cette question a été signalée
3 Réponses
22305 Vues

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
Ignorer

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

Meilleure réponse

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
Ignorer
Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
0
févr. 22
1758
0
nov. 18
5002
0
févr. 23
2086
3
août 19
12781
2
déc. 18
13035