Skip to Content
Menu
This question has been flagged
4 Replies
11488 Views

Hii,

I have a custom report on a pre-printed continuous paper. I am using web.internal_layout. The header is printing on first page only. How to print header on all pdf pages. 

Here is my xml xode.

<template id="sales_invoice_dot_matrix_report"> 
    <t t-call="web.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="web.internal_layout">
                <div class="page">
                 <div class="row">
                            This is my Header
                 </div>

                 <div class="row justify-content-end">  
                 <table class="table table-sm o_main_table" name="invoice_line_table">
                    <t t-foreach="o.invoice_line_ids" t-as="line">
                        These are lines
                    </tr>
                 </table>
                 </div>
                            <div class="footer">
                                This is footer
                            </div
                        </div>
                    </t>
                </t>
             </t>
Avatar
Discard
Author Best Answer

To fit my requirement, I created my own template because it is pre-printed dot matrix report. Here is my template.

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="paperformat_invoice_sales_dot_matrix" model="report.paperformat">
        <field name="name">Sales Invoice Dot Matrix</field>
        <field name="default" eval="False"/>
        <field name="format">custom</field>
        <field name="page_width">215</field>
        <field name="page_height">280</field>
        <field name="orientation">Portrait</field>
        <field name="margin_top">73</field>
        <field name="margin_bottom">23</field>
        <field name="margin_left">5</field>
        <field name="margin_right">10</field>
        <field name="header_line" eval="False"/>
        <field name="header_spacing">68</field>
        <field name="dpi">90</field>
    </record>

    <template id="sales_invoice_dot_matrix_report">
        <t t-call="web.html_container">
            <t t-foreach="docs" t-as="o">
                <div class="header">
                    <div class="row">
			Header
                    </div>
                </div>
                <div class="article">
                    <div class="page">
                        <div class="row justify-content-end">
				Report Body
			</div>
                    </div>
                </div>
                <div class="footer" style="font-size:12px;">
                    Footer
                </div>
            </t>
        </t>
    </template>

    <report
            id="report_sales_invoice_dot_matrix"
            model="account.invoice"
            string="Sales Invoice Dot Matrix"
            report_type="qweb-pdf"
            name="name"
            file="name"
            print_report_name="(object._get_report_base_filename())"
            groups="account.group_account_invoice"
            paperformat="paperformat_invoice_sales_dot_matrix"
    />
</odoo>

Avatar
Discard
Best Answer

Hello Anees!

I think you should use class="page" in div. It will solve your problem.

For Example:

<template id="issue_return_report_template">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="web.external_layout">
<div class="page">
<br/>
<br/>
<div class="row">
<div class="col-xs-2">
<strong>Issue Number :</strong>
</div>
<div>
<span t-field="doc.name"/>
</div>

<div class="col-xs-2">
<strong>Date :</strong>
</div>
<div>
<span t-field="doc.date"/>
</div>
<div class="col-xs-2">
<strong>Location :</strong>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
Avatar
Discard
Best Answer

Hi,

You can also refer the blog below of creating a custom qweb report


Regards

Avatar
Discard