Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

PDF report: page break mess

By
PY
on 2/17/15, 4:11 AM 3,821 views

Hi ! I'm on Odoo (v8).

Unable to fix this:

http://i.imgur.com/nSWiu6B.png?1

Anyone have a fix for that ? (either by changing css or changing qweb template)

Default qweb template for the report_saleorder_document vue.

<?xml version="1.0"?>
<t t-name="sale.report_saleorder_document">
    <t t-call="report.external_layout">
        <div class="page">
            <div class="oe_structure"/>
            <div class="row">
                <div class="col-xs-6">
                    <strong t-if="o.partner_shipping_id == o.partner_invoice_id">Invoice and shipping address:</strong>
                    <strong t-if="o.partner_shipping_id != o.partner_invoice_id">Invoice address:</strong>
                    <div t-field="o.partner_invoice_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;, &quot;phone&quot;, &quot;fax&quot;], &quot;no_marker&quot;: true}"/>
                    <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
                    <div t-if="o.partner_shipping_id != o.partner_invoice_id" class="mt8">
                        <strong>Shipping address:</strong>
                        <div t-field="o.partner_shipping_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;, &quot;phone&quot;, &quot;fax&quot;], &quot;no_marker&quot;: true}"/>
                        <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
                    </div>                        
                </div>
                <div class="col-xs-5 col-xs-offset-1">
                    <div 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}"/>
                </div>
            </div>

            <h2>
                <span t-if="o.state not in ['draft','sent']">Order N° </span>
                <span t-if="o.state in ['draft','sent']">Quotation N° </span>
                <span t-field="o.name"/>
            </h2>

            <div class="row mt32 mb32" id="informations">
                <div t-if="o.client_order_ref" class="col-xs-3">
                    <strong>Your Reference:</strong>
                    <p t-field="o.client_order_ref"/>
                </div>
                <div t-if="o.date_order" class="col-xs-3">
                    <strong t-if="o.state not in ['draft','sent']">Date Ordered:</strong>
                    <strong t-if="o.state in ['draft','sent']">Quotation Date:</strong>
                    <p t-field="o.date_order"/>
                </div>
                <div t-if="o.user_id.name" class="col-xs-3">
                    <strong>Salesperson:</strong>
                    <p t-field="o.user_id.name"/>
                </div>
                <div t-if="o.payment_term" class="col-xs-3">
                    <strong>Payment Term:</strong>
                    <p t-field="o.payment_term"/>
                </div>
            </div>

            <table class="table table-condensed">
                    <thead>
                    <tr>
                        <th>Description</th>
                        <th>Taxes</th>
                        <th class="text-right">Quantity</th>
                        <th class="text-right">Unit Price</th>
                        <th groups="sale.group_discount_per_so_line">Disc.(%)</th>
                        <th class="text-right">Price</th>
                    </tr>
                </thead>
                <tbody class="sale_tbody">
                    <tr t-foreach="o.order_line" t-as="l">
                        <td>
                           <span t-field="l.name"/>
                        </td>
                        <td>
                            <span t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/>
                        </td>
                        <td class="text-right">
                            <span t-field="l.product_uom_qty"/>
                            <span groups="product.group_uom" t-field="l.product_uom"/>
                        </td>
                        <td class="text-right">
                            <span t-field="l.price_unit"/>
                        </td>
                        <td groups="sale.group_discount_per_so_line">
                            <span t-field="l.discount"/>
                        </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.pricelist_id.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>Total Without Taxes</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.pricelist_id.currency_id&quot;}"/>
                            </td>
                        </tr>
                        <tr>
                            <td>Taxes</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.pricelist_id.currency_id&quot;}"/>
                            </td>
                        </tr>
                        <tr class="border-black">
                            <td><strong>Total</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.pricelist_id.currency_id&quot;}"/>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>

            <p t-field="o.note"/>
            <p t-if="o.payment_term.note">
                <strong>Payment Term:</strong>
                <span t-field="o.payment_term.note"/>
            </p>
            <div class="oe_structure"/>
        </div>
    </t>
</t>

You need to change the qweb template, if you post your code i will help in that.

Umashankar Subramani
on 2/17/15, 4:56 AM

So far, I have the default template.

PY
on 2/17/15, 5:11 AM
0
PY
On 2/17/15, 6:00 AM

Temporary solution:

Replace the thead with a p tag. This way, the column headers will only show on the first page, while still be aligned with the content.

Ugly solution, but that works for now.

2
Emad Jaddou
On 3/10/15, 3:38 PM

I struguled for days on this, and finally found out that the issue is because of wkhtmltopdf.exe. you must use version 12.2.0.0 

Once I downgraded, everything worked just fine. Make sure also you have set the paramaters for webkit_path and report_url http: //0.0.0.0:8069/ in the Settings > Technical > Paramaters > System Paramters

more details www.odoo.com/forum/help-1/question/invoice-layout-issues-74445

1

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 2/17/15, 5:35 AM

Hi,

The following are the types of page breaks used for the reports:

you can use any one of therse:

<p style="page-break-before:always;"> </p> (mostly reports used 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">

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

Thanks, I'll try these, though I don't know which one will work, and where.

PY
on 2/17/15, 5:38 AM

What was that ? Curious if your solution should work.

PY
on 2/17/15, 8:04 AM

use the one which is bold letters..

Vasanth
on 2/17/15, 8:26 AM

And I put that where ? On the thead ? Already tried. Sorry, didn't mess with styling for a while.

PY
on 2/17/15, 8:36 AM

please explain your answer (thank you)

yasmina
on 8/28/16, 8:35 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/17/15, 4:11 AM
Seen: 3821 times
Last updated: 3/16/15, 8:10 AM