Odoo:如何在自定义报告(pdf)中包含“分页符”/第二页?

时间:2015-09-24 08:35:16

标签: pdf report odoo page-break

我使用本指南从头开始创建了一份新报告:http://odoo.guide/report-design-workshop/

我的问题: 如果我的报告中有很多产品,则不会显示包括总金额等在内的最后一部分。我想有一个分页符或至少第二个pdf页面。

注意:如果我使用基本的odoo报告,我在pdf中有第二页,但它显示如下: http://fs5.directupload.net/images/150924/bf9lsx6u.jpg

欢迎任何其他想法!

编辑: 在使用分页符标记的基本报告中,工作真的很好,但它根本不会影响我自己的报表设计。

我的代码尝试使用分页符标记:

account.Name_report

<?xml version="1.0"?>
<t t-name="account.Name_report">
<t t-call="report.Name_layout">
<t t-foreach="docs" t-as="o"> <!-- this makes the context model data accessible throughout the variable "o" -->

<div class="page"> 

<div style="color:white">.</div><!--as reference for fixed positions-->

<img src="/document/static/img/Briefpapier_rechnung.svg" style="position: fixed; left:-20px;top:0px;z-index:-100"/>

<div style="color: white;
    font-size: 20px;
    z-index: 1;
    position: fixed;
    left: 390px;
    top: 36px;
    font-size: 38px;">Rechnung
</div>

<!--Adresse-->
<div style="color: black;
    font-size: -1px;
    z-index: 1;
    position: fixed;
    top: 138px;
    left: 60px;
    font-size: 12px;">
    <span style="text-decoration: underline;">Adress Adress Adress</span><br/>
<address t-field="o.partner_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: true}"/><br/>
</div>

<!--Kunden Nr/Datum-->
<div style="color: black;
    font-size: -1px;
    z-index: 1;
    position: fixed;
    left: 450px;
    top: 255px;
    font-size: 12px;">
<span>Referenz Nr.:</span><br/>
<span>Datum:</span>
</div>

<div style="color: black;
    font-size: -1px;
    z-index: 1;
    position: fixed;
    top: 255px;
    right: 0px;
    font-size: 12px;
    text-align: right;">
<span t-field="o.reference"/><br/>
<span  t-field="o.date_invoice"></span>
</div>

<!--Rechnung Nr.-->
<div style="color: black;
    font-size: 20px;
    z-index: 1;
    position: fixed;
    left: 0px;
    top: 335px;
    font-size: 16px;
    font-weight: bold;">

                <span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Rechnung</span>
                <span t-if="o.type == 'out_invoice' and o.state == 'proforma2'">PRO-FORMA</span>
                <span t-if="o.type == 'out_invoice' and o.state == 'draft'">Rechnungsentwurf</span>
                <span t-if="o.type == 'out_invoice' and o.state == 'cancel'">abgebrochene Rechnung</span>
                <span t-if="o.type == 'out_refund'">Erstattung</span>
                <span t-if="o.type == 'in_refund'">Lieferant Rückerstattung</span>
                <span t-if="o.type == 'in_invoice'">Lieferant Rechnung</span>
                <span t-field="o.number"/>
</div>

**<p style="page-break-before:always;"> </p>**
<!--page-break test-->


<div class="row" style="top:400px;  position: fixed;">

<!--TABLE-->
      <table class="table table-condensed">
                <thead>
                    <tr>
                        <th>Beschreibung</th>
                        <th>Menge</th>
                        <th class="text-right">Einzelpreis EUR</th>
                        <th class="text-right" groups="sale.group_discount_per_so_line">Rabatt (%)</th>
                        <th class="text-right">Steuern</th>
                        <th class="text-center">Gesamtpreis EUR</th>
                    </tr>
                </thead>
                <tbody class="invoice_tbody">
                    <tr t-foreach="o.invoice_line" t-as="l">
                        <td><span t-field="l.name"/></td>
                        <td>
                            <span t-field="l.quantity"/>
                            <span t-field="l.uos_id" groups="product.group_uom"/>
                        </td>
                        <td class="text-right">
                            <span t-field="l.price_unit"/>
                        </td>
                        <td class="text-right" groups="sale.group_discount_per_so_line"><span t-field="l.discount"/></td>
                        <td class="text-right">
                            <span t-esc="', '.join(map(lambda x: x.name, l.invoice_line_tax_id))"/>
                        </td>
                        <td class="text-right">
                            <span t-field="l.price_subtotal" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
                        </td>
                    </tr>
                </tbody>
            </table>

            <div class="row">
                <div class="col-xs-4 pull-right">
                    <table class="table table-condensed">
                        <tr class="border-black">
                            <td><strong>Gesamt Netto</strong></td>
                            <td class="text-right">
                                <span t-field="o.amount_untaxed" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
                            </td>
                        </tr>
                        <tr>
                            <td>Steuern</td>
                            <td class="text-right">
                                <span t-field="o.amount_tax" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
                            </td>
                        </tr>
                        <tr class="border-black">
                            <td><strong>Gesamtbetrag</strong></td>
                            <td class="text-right">
                                 <span t-field="o.amount_total" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>

            <div class="row" t-if="o.tax_line">
                <div class="col-xs-6">
                    <table class="table table-condensed">
                        <thead>
                            <tr>
                                <th>Steuern</th>
                                <th class="text-right">Steuergrundbetrag</th>
                                <th class="text-right">Betrag</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr t-foreach="o.tax_line" t-as="t">
                                <td><span t-field="t.name"/></td>
                                <td class="text-right">
                                    <span t-field="t.base" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
                                </td>
                                <td class="text-right">
                                    <span t-field="t.amount" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
                                </td>
                            </tr>
                        </tbody>
                    </table>

<span>Zahlbar innerhalb 14 Tagen ohne Abzug</span>
</div>
</div>
</div>





    </div>
  </t>
  </t>
</t>

1 个答案:

答案 0 :(得分:18)

有一些分页符类型可用于Qweb报告。

您可以使用以下标签之一:

<p style="page-break-before:always;"> </p> (most reports use this type)

<p style="page-break-after:always"></p>

<div style="page-break-after: auto;"><span style="display: none;"> </span></div>

<p style="page-break-inside: avoid"></p>

<div style="page-break-inside: auto"></div>