Saloua SAHNOUNE
Saloua SAHNOUNE

Reputation: 205

Odoo 10 QWeb report

I want to insert a logo in the header of a report using Odoo 10.

I tested

<img t-att-src = "'/ lt_sales / static / src / img / logo.png'" />

and

<img class = "img" src = "/ lt_sales / static / src / img / logo.png" />

It's working In Odoo 8 without any problem, but not in Odoo 10. Why is that, and how can I fix it?

Upvotes: 0

Views: 595

Answers (2)

AndresB
AndresB

Reputation: 51

I had this code in the header to show the logo of the company and was not working:

    <div style="max-height: 78px">
        <img t-if="company.logo" t-att-src="image_data_uri(company.logo)" style="max-width: 100%; height: auto;align-items: center; " alt="Logo"/>
    </div>

And I changed to this and is working ok:

    <div style="max-height: 76px">                          
        <img t-if="company.logo" t-attf-src="data:image/*;base64,{{company.logo}}" t-att-alt="logo" style="max-width: 100%; height: auto;align-items: center; "/>
    </div>

There is also another funny and hard to spot and explain issue.

I had production and development environment both running Ubuntu 20.04.3 LTS. I checked the wkhtmltopdf version and both were wkhtmltopdf 0.12.6 (with patched qt).

I found one report that with some records did not show the logo, if I excluded some records, the logo was ok. In the development environment the logo was ok in every case. So I copied the wkhtmltopdf from the development environment to production and now it seems to be working ok.

So if you try everything and you have problemns with the logos, try to download another version of wkhtmltopdf.

Upvotes: 0

Sankar guru
Sankar guru

Reputation: 1015

If you want using company logo:

<div class="col-xs-6 text-right">
    <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 50px;" />
</div>

If you want insert static image the report you need to have the image in the folder:

<div class="col-xs-6 text-right">
    <img class="img-responsive" src="/lt_sales/static/src/img/logo.png" style="max-height: 50px;" />
</div>

Upvotes: 2

Related Questions