【问题标题】:Odoo - page number in qweb reportsOdoo - qweb 报告中的页码
【发布时间】:2018-02-07 17:25:40
【问题描述】:

我正在使用 odoo 10 中的 qweb 报告。这就是我所做的

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

我也试过这个

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

但在这两种情况下我都看不到页码。我还尝试在单独的模板中添加自定义页眉和页脚,但这也不起作用。

【问题讨论】:

  • 我认为这与css有关,Page:是否打印在工作表上
  • 第一个问题是页脚在页面内:
  • 是的,在纸张上打印没有任何问题,我也尝试将它放在page div 之后。
  • 你需要使用report.internal_layout吗?使用report.external_layout,页面已经默认出现在页脚

标签: odoo odoo-10 odoo-9 qwebview


【解决方案1】:

试试这个:

<div class="footer">
  <div class="row">
     <center><span>Page </span><span class="page" /> of <span class="topage" /></center>
  </div>
</div>

它非常适合我。

注意:我用过没有打电话report.external_layout

【讨论】:

    【解决方案2】:
    • 请尝试使用此代码获取 Qweb-report 中的页码。会自动显示页码。

      &lt;t t-call="report.external_layout"&gt;&lt;/t&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多