Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
8599 Lượt xem

I would like to insert an image from mymodule folder but the image doesn't display. I'm using docker for this odoo.


This is my code:

<img src='/trabaud/static/img/img.png' width="100%" height="100%"/>

but image not show


I found a similar case: https://github.com/odoo/odoo/issues/32674 but in my case, this solution is not working.


Could anyone help me, please?

Ảnh đại diện
Huỷ bỏ

Try to just replace 'src' to 't-attf-src', Hope it will be work.

try this:

<t t-if="record.image and record.image.raw_value !== false">

<img t-att-src="'data:image/png;base64,'+record.image.raw_value" class="oe_avatar oe_kanban_avatar_smallbox"/>

</t>

Câu trả lời hay nhất
 <img class="img img-responsive" t-att-src="'/module_name/static/src/img/image.png'" height="120" width="120" />

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,

Try this code,

Your image should be saved inside yourmodule/static/src/img/image name

<img src='/module name/static/src/img/image name with extention' style="max-height: 45px;"/>

In case if you have stored your image in a binary field then use this,

<img t-attf-src="data:image/*;base64,{{o.field_name}}" style="max-height: 80px;max-width: 145px;padding:2px;" align="center"/>

Check this link too

https://www.odoo.com/forum/help-1/display-image-in-qweb-report-76746

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 22
5417
2
thg 3 21
3567
0
thg 12 20
3469
0
thg 5 20
2570
0
thg 1 20
2095