Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
33131 Vistas

I created a new report from scratch using this guide: http://odoo.guide/report-design-workshop/

My Problem:
If I have a lot of products on my report the last part including total amount etc. is not shown. I would like to have a kind of page break or at least a second pdf page.

Note: If I use the basic odoo report I have a second page in the pdf but it is shown as this: 
http://fs5.directupload.net/images/150924/bf9lsx6u.jpg

Any other ideas are welcome!

Edit: In the basic report using the page-break tag works realy fine but it didnt affect my own report design at all.

My Code trying to use the page-break tag:

account.Name_report

<?xml version="1.0"?>

<t t-name="account.HanDS_report">
<t t-call="report.HanDS_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>

<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;">HanDS GmbH, Wendenstr. 377, 20537 Hamburg</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>

<h2>

</h2>

<!--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>
<div class="row" style="top:400px; position: fixed;">
<!--TABLE TEST-->

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

Same problem, but my report is coming in two pages instead of one, how did you guys solved the issue?


Mejor respuesta

You could do a page break in qweb using something like this:

<div style="page-break-before: always;">
...
</div>

use page-break-before or page-break-after and you could do a conditional break wrapping that snippet in a "t-if" statement

Avatar
Descartar
Autor

Thank you, that work realy fine for the basic odoo report. But unfortunately that didnt affect my own report design at all. Any Solution where I config a second pdf page because my own report always shows only 1 page.

With that way I force wkhtml2pdf to change the page to display the next content, what did you mean with your own report design?

Autor

I used this guide to build a own report and I only have 1 pdf page: http://odoo.guide/report-design-workshop/

I don't see how the html snippet provided doesn't affect your report layout. When you put on your report architecture you will cause a page break, you just need to define where. For example you can check the number of lines per page that you wanna show to insert the

before the next line to cause it to go for the next page. Test it and share the results
Autor

I used

to test it. As I said it works on basic report. I added my code to the original question.
Autor

* p style="page-break-before:always;"

could you post the content of report.HanDS_layout too??

could you test it by put some content inside of the
*p style="page-break-before:always;"*

Autor

It works! I had to put content inside the

-tag. Thank you very much!

Autor

Now I have a new Problem, I always have at least 2 pages now? But I only need one page if there arent many products on the report. Any Solution?

Autor

Solution: I used style="page-break-before:auto" and set the position of the table div to position:relative;

Publicaciones relacionadas Respuestas Vistas Actividad
0
sept 24
1411
0
mar 18
3538
0
jul 17
7829
1
nov 16
2969
1
ene 16
4206