Search code examples
reportreportingodoo-12qweb

Odoo 12 report invoice details on every page. How to achieve?


I am using Odoo 12 and have a legal requirement regardless report invoice and sale report. I have to show the document details (document type, number, date, etc.) on every report page (not just the first one).

So, core Odoo report invoice allows me to print this information only at the first page. In Odoo report invoice we have (at first page):

Customer Name
Customer Address
...
Country
VAT

Below we have document details with number, date, etc.

What I need to do is to show the document details on the top of the page (starting from page 2), like:

Customer: Customer Name
Document Type: Invoice
Number: INV XXX/2020
Issue Date: 10-10-2020

I am able to add the desired values to variables in qweb but don't now how to check if page > 1.

Can anyone help me include this information at the top of every page other than the first one? I have searched and could not find any solution for this.


Solution

  • pmatos,

    Try to add this to your report template. In this, you have to add on the header part with your Content Data(including document type, number, date, etc).

    <template id="external_layout_standard_customise" inherit_id="web.external_layout_standard">
        <xpath expr="//div[hasclass('header')]" position="inside">
            <t t-if="o and o._name == 'sale.order'">
                <div class="pull-right">
                    <h2>
                        <t t-if="not (env.context.get('proforma', False) or is_pro_forma)">
                            <span t-if="doc.state not in ['draft','sent']">Order # </span>
                            <span t-if="doc.state in ['draft','sent']">Quotation # </span>
                        </t>
                        <t t-if="env.context.get('proforma', False) or is_pro_forma">
                            <span>Pro-Forma Invoice # </span>
                        </t>
                        <span t-field="doc.name"/>
                    </h2>
                </div>
            </t>
        </xpath>
    </template>
    

    Thanks