Jack Sparrow
Jack Sparrow

Reputation: 666

How to display table header in all page in qweb report odoo

I have one Qweb report which has table it contains table header and table data now issue is in multiple page report. if any char or text field has long text it overlaps with header. see below images of both pages of report.

first page

second page

My Table Code is:

<table  class="table table-bordered" width="100%" >
                                <thead >
                                    <tr style="page-break-inside: avoid;">
                                        <td class="text-left">Code</td>
                                        <td class="text-left">Description</td>
                                        <td class="text-left">U/M</td>
                                        <td class="text-right">QTY</td>
                                        <td class="text-right">RATE</td>


                                    </tr>
                                </thead>
                                <tbody class="invoice_tbody">
                                <tr  t-foreach="o.invoice_line_ids" t-as="l">
                                    <td><span t-field="l.product_id.default_code"/></td>
                                    <td><span t-field="l.name"/></td>
                                    <td><span t-field="l.uom_id.name"/></td>
                                    <td><span t-field="l.quantity"/></td>
                                    <td><span t-field="l.price_unit"/></td>                         
                                </tr>
                                 <tr>
                                     <td class="text-left" colspan="5">
                                        <b>GRAND TOTAL AED : </b>
                                     </td>
                                     <td class="text-left" colspan="2">
                                        <b>
                                            <t t-set="total" t-value="0"/>
                                                <t t-foreach="o.invoice_line_ids" t-as="f">
                                                    <t t-set="total" t-value="total+f.price_subtotal"/>
                                                    <t t-if="f_last">
                                                        <strong>
                                                        <t t-esc="total"/>
                                                        </strong>
                                                </t>
                                            </t>
                                        </b>
                                     </td>
                                     <td>
                                            <b><span t-field="o.amount_tax"/></b>
                                     </td>
                                     <td >
                                            <b>
                                            <t t-set="total" t-value="0"/>
                                                <t t-foreach="o.invoice_line_ids" t-as="f">
                                                    <t t-set="total" t-value="total+f.price_total"/>
                                                    <t t-if="f_last">
                                                        <strong>
                                                        <t t-esc="total"/>
                                                        </strong>
                                                </t>
                                            </t>
                                        </b>
                                     </td>
                                 </tr>
                             </tbody>
                        </table>

Upvotes: 0

Views: 3725

Answers (2)

Naveen V
Naveen V

Reputation: 1

Try adding style display: table-header-group; in thead tag. This should do the trick !

Upvotes: 0

Deval
Deval

Reputation: 136

Error can be slove by two ways

1) Go to Settings -> Reports Paper Format -> create a Paper Format duplication of European A4 and modify
Header Spacing : 40
Associated Reports : "Report Name"

2) Other by code in xml

<!-------------Create Paper Format------------------------>
<record id="report_paperformat_id" model="report.paperformat">
        <field name="name">Test</field>
        <field name="default" eval="True" />
        <field name="format">A4</field>
        <field name="page_height">0</field>
        <field name="page_width">0</field>
        <field name="orientation">Portrait</field>
        <field name="margin_top">42</field>
        <field name="margin_bottom">23</field>
        <field name="margin_left">7</field>
        <field name="margin_right">7</field>
        <field name="header_line" eval="False" />
        <field name="header_spacing">40</field>
        <field name="dpi">90</field>
 </record>

<!---set paper format to Report -->
<record id="report_module.report" model="ir.actions.report.xml">
        <field name="paperformat_id" ref="report_module.report_paperformat_id" />
</record>

Upvotes: 0

Related Questions