Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
6 Odpowiedzi
6018 Widoki

Hi Guys,

Good morning to everyone,

I have a little query about the company logo. In the all email template odoo recognized the company logo by using the following code.

<img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}" />

But In the above-mentioned path, I can able to saw odoo's official logo only. But While sending an email I can able to saw my company logo. How is it possible. If anyone can help me to understand this logic?


Awatar
Odrzuć
Najlepsza odpowiedź

Hello,

Try following code, hope it will help you.

<img t-if="o.company_id.logo" t-att-src="'data:image/png;base64,%s' %o.company_id.logo" style="width:200px;height:135px;"/>


Thanks & Regards

Awatar
Odrzuć
Autor

Hi Ankit,

Thanks for your response.

But my requirement is want to update the image dynamically based on user upload.

Refer updated answer.

Autor

I already tried the updated solution. But the image was broken in E-Mail. So only I asked here how odoo recognizes the company logo in the Companies.

Najlepsza odpowiedź
Hello,
Try following code, hope it will help you.
<img t-if="o.company_id.logo" t-att-src="'data:image/png;base64,%s' % to_text(o.company_id.logo)"
style="width:200px; height:135px;"/>

Thanks
Awatar
Odrzuć
Najlepsza odpowiedź

If you have a file path in your image source, then you can find the image in the module's static folder. In Ankit's answer, the image is retrieved from the database.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
5
wrz 20
6452
0
paź 24
1206
0
sie 23
2565
9
cze 23
13125
1
gru 22
2303