Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
5 Odpovědi
30296 Zobrazení

Hello, 

I use Odoo v.10 community (10.0-20170723) and I have edited QWEB report_saleorder_document.

I need to add in a report my company logo (the same logo that I have on top-left odoo installation).

I have try to add this line in the report:

<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' %company.logo"/>

but I have, on client, the error of internal server. 

On server, the error is:

Error to render compiling AST
AttributeError: 'NoneType' object has no attribute 'logo'
Template: sale.report_saleorder_document
Path: /templates/t/t/div/div[1]/div[1]/img
Node: <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' %company.logo" data-oe-id="671" data-oe-model="ir.ui.view" data-oe-field="arch" data-oe-xpath="/t[1]/t[1]/div[1]/div[1]/div[1]/img[1]"

How I can solve it?

Before this line, in my QWEB, I have a call of

<t tcall="report.external_layout">

I need another call?

Thanks

Avatar
Zrušit
Nejlepší odpověď

You can use doc.company_id or res_company for company logo:

Like

<img t-if="res_company.logo" t-att-src="'data:image/png;base64,%s' %res_company.logo"/>
OR
<img t-if="doc.company_id.logo" t-att-src="'data:image/png;base64,%s' %doc.company_id.logo"/>

Avatar
Zrušit

In your code, <t tcall="report.external_layout"> replace with <t t-call="report.external_layout">

Nejlepší odpověď
<div style="width: 45%;">
<img t-att-src="image_data_uri(o.company_id.logo)"/></div>
Avatar
Zrušit
Nejlepší odpověď

Hi,

You can add the company logo to report using this,

<div style="width: 45%;float: left;">
    <img src='/web/binary/company_logo' style="width:100%"/>
</div>
Avatar
Zrušit
Autor Nejlepší odpověď

Thanks a lot, 

works all solutions!!!

Enjoy!!!

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
čvc 25
1942
2
čvc 25
1058
1
kvě 25
2033
1
dub 25
2450
1
úno 25
1734