怎样才能在报告中打印页码

时间:2018-06-07 13:44:18

标签: xml python-2.7 odoo-9

我正在使用odoo 9我创建了一个自定义报告,我已尝试使用此代码在报告中打印页数,但每次只显示单词页面:/ 没有数字。有什么帮助吗?        <ul class="list-inline>" <li>Page:</li> <li> <span class="page"/> </li> / <li> <span class="topage"/> </li> </ul>

enter image description here

1 个答案:

答案 0 :(得分:1)

看起来不错。如果您查看UI / views /并搜索&#34; report.external_layout_footer&#34;你会看到你提到的代码正在运行。 我认为你可能忘记插入适当的div 看看这个:

<?xml version="1.0"?>
<t t-name="report.external_layout_footer">
    <div class="footer">
        <div class="text-center" style="border-top: 1px solid black;">
            <ul t-if="not company.custom_footer" class="list-inline">
                <li t-if="company.phone">Phone: <span t-field="company.phone"/></li>

                <li t-if="company.fax and company.phone">&amp;bull;</li>
                <li t-if="company.fax">Fax: <span t-field="company.fax"/></li>

                <li t-if="company.email and company.fax or company.email and company.phone">&amp;bull;</li>
                <li t-if="company.email">Email: <span t-field="company.email"/></li>

                <li t-if="company.website and company.email or company.website and company.fax or company.website and company.phone">&amp;bull;</li>
                <li t-if="company.website">Website: <span t-field="company.website"/></li>
            </ul>

            <ul t-if="not company.custom_footer" class="list-inline" name="financial_infos">
                <li t-if="company.vat">TIN: <span t-field="company.vat"/></li>
            </ul>

            <t t-if="company.custom_footer">
                <span t-raw="company.rml_footer"/>
            </t>

            <ul class="list-inline">
                <li>Page:</li>
                <li><span class="page"/></li>
                <li>/</li>
                <li><span class="topage"/></li>
            </ul>
        </div>
    </div>      
</t>

好的,现在可能的解决方案 - 插入报告<div class="footer">

有用的资源:

https://www.odoo.com/forum/help-1/question/how-to-add-page-number-in-qweb-reports-in-odoo-74996

https://www.odoo.com/forum/help-1/question/odoo-page-number-in-qweb-reports-129335