【问题标题】:Display header only on the first page and footer on the last page Qweb Odoo 14仅在第一页显示页眉,在最后一页显示页脚 Qweb Odoo 14
【发布时间】:2021-05-05 21:18:17
【问题描述】:

我正在开发 Odoo 14 , 我想只在第一页显示页眉,只在最后一页显示页脚, 我该怎么做 ?请问有什么帮助吗?? 谢谢。

    <template id="report_invoice_document_extend" inherit_id="account.report_invoice_document">
       <xpath expr="//t[@t-call='web.external_layout']" position="attributes">
            <attribute name="t-call">my_module.external_invoice_layout</attribute>
       </xpath>
    </template>
 
<template id="external_layout_standard">
       <div t-attf-class="header o_company_#{company.id}_layout " t-att-style="report_header_style" >
       ...
    </div>

    <div t-attf-class="article o_report_layout_standard o_company_#{company.id}_layout"  t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')">
       ....
    </div>
</template>
       
<template id="external_invoice_layout">
    <t t-if="not o" t-set="o" t-value="doc"/>

    <t t-if="not company">
        <!-- Multicompany -->
        <t t-if="company_id">
            <t t-set="company" t-value="company_id"/>
        </t>
        <t t-elif="o and 'company_id' in o">
            <t t-set="company" t-value="o.company_id.sudo()"/>
        </t>
        <t t-else="else">
            <t t-set="company" t-value="res_company"/>
        </t>
    </t>
    <t t-call="my_module.external_layout_standard">
        <t t-raw="0"/>
    </t>
</template>

【问题讨论】:

    标签: javascript python xml odoo


    【解决方案1】:

    我实现了我的自定义报告,但与你不同。但你可以参考我的代码。你可以使用最后一页类。

    You sent Today at 4:26 PM
    <div class="footer" t-attf-style="font-size:{{style.footer_font}}px !important;font-family:{{style.font_family}} !important;">
                     <div class="last-page">
                    <div class="row">
                      <div class="col-12">
                        <div class="col-6 float-right" style="padding-left:0px; padding-right:0px; page-break-inside: avoid !important;">
                            <table class="table table-condensed" t-attf-style="color:{{style.text_color}};font-size:{{int(style.body_font)+4}}px;"><tbody>
                                
                                <tr t-attf-style="border-top: 1px solid {{style.text_color}};">
                                    <td t-attf-style="border-top: 1px solid {{style.text_color}} !important;"><strong>Total Quantity</strong></td>
                                    <td class="text-right" t-attf-style="border-top: 1px solid {{style.text_color}} !important;">
                                        <span t-esc="sum(line.product_qty for line in o.move_lines.filtered(lambda move: move.state not in ('cancel')))"/>
                                    </td>
                                </tr>
                                <tr t-attf-style="border-top: 1px solid {{style.text_color}};">
                                    <td t-attf-style="border-top: 1px solid {{style.text_color}} !important;"/>
                                    <td class="text-right" t-attf-style="border-top: 1px solid {{style.text_color}} !important;"> 
                                    </td>
                                </tr>
                                <tr t-attf-style="border-top: 1px solid {{style.text_color}};">
                                    <td t-attf-style="border-top: 1px solid {{style.text_color}} !important;"/>
                                    <td class="text-right" t-attf-style="border-top: 1px solid {{style.text_color}} !important;"> 
                                    </td>
                                </tr>
                               
                                </tbody>
                            </table>
                    </div>
                </div>
            </div>
        </div>
        <div>

    【讨论】:

      【解决方案2】:

      在报告中,您可以在正文中定义页眉和页脚标记,以替换默认的页眉和页脚。如果您不想定义任何页眉或页脚,那么您可以自己放置页眉和页脚标签,无需在其中提供任何代码。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-27
        • 2018-10-03
        • 1970-01-01
        • 2018-12-28
        • 2021-01-18
        相关资源
        最近更新 更多