This question has been flagged
4 Replies
47976 Views

I have inherited the `account.report_invoice_document` and added a footer after the 

    <div class="page">

    ...........................

    .............................

    ............................

    </div>

    <div class="footer">

    ............................

    </div>

 

But in the report, the footer is missing. How to add custom footer in invoice reports made of Qweb in Odoo?

Avatar
Discard
Best Answer

Why don't you modify the existing footer template or create a second one which you only use in this report?
You can do this under report/views/layouts.xml. Here is the template for the default footer and header.
You have four options:

  1. Modify existing footer (addons/report/views/layouts.xml)
  2. Create a new footer template (addons/report/views/layouts.xml)
  3. Add the code directly in your report.
  4. Use the default HTML field for a custom footer under your company settings.

Default footer:

<template id="invoice_layout_footer">
    <div class="footer">
        <div class="text-center" style="border-top: 1px solid black;">
            <ul t-if="not company.custom_footer" class="list-inline">
                <li t-if="company.phone">Phone: <span t-field="company.phone"/></li>

                <li t-if="company.fax and company.phone">&amp;bull;</li>
                <li t-if="company.fax">Fax: <span t-field="company.fax"/></li>

                <li t-if="company.email">&amp;bull;</li>
                <li t-if="company.email">Email: <span t-field="company.email"/></li>

                <li t-if="company.website">&amp;bull;</li>
                <li t-if="company.website">Website: <span t-field="company.website"/></li>
            </ul>

            <t t-if="company.custom_footer">
                <span t-raw="company.rml_footer"/>
            </t>

            <ul class="list-inline">
                <li>Page:</li>
                <li><span class="page"/></li>
                <li>/</li>
                <li><span class="topage"/></li>
            </ul>
        </div>
    </div>      
</template>

You could choose to modify this one or you could create a second one. For example:

<template id="external_layout_footer">
    <div class="footer">
        <div class="text-center" style="border-top: 1px solid black;">
            <ul t-if="not company.custom_footer" class="list-inline">
                <li t-if="company.phone">E-mail: <span t-field="company.email"/></li>

            </ul>
        </div>
    </div>      
</template>

You could then call report.external_layout_footer in your report. Or you could directly add this code in your current invoice.

Avatar
Discard

why i can not add a img to the footer? i have a module this is my code: <xpath expr="//div[@class='footer']" position="replace">

<xpath expr="//div[@class='footer']" position="replace">

    
		
            <xpath expr="//div[@class='footer']" position="replace">
				
            
        
    

Best Answer

Hello Gopakumar,

The Yenthe's answer is corret. for header tempalte. I would give you brief explaination on this.

In the addons you will find report module. In that all the header footer templates are defined. you can take reference from there.

path : addons/report/views/layout.xml  (All the report layouts are defined in this file.)

Either You can override the existing tempalte like xml record or Define your template for header and footer above on your report and give reference in place of "report.external_layout" template.

Simply you can apply bootstrap css classes for your header and footer on your custom template.

Hope This will clear more regarding header and footer.

Regards,

Anil.

 

 

 

 

Avatar
Discard

Thanks @ Anil Kesariya for given more information.

Best Answer

I have followed these steps but not working in odoo-8. Can any one help me https://www.odoo.com/forum/help-1/question/why-invoice-footer-not-showing-in-the-report-81492

Avatar
Discard
Best Answer

You go to Settnings/Companies, select comapny and Report Configuration. Check Custom Footer and in Report Footer you include your html code.

Avatar
Discard

This doesn't reflect with odoo v8. We need to override the existing template for header footer or we have to add our own template for footer and header in qweb.