How to add Static Images ?

It is very simple to show static images in Odoo Qweb templates (viewes or reports).

For that you need to add your image inside static directory



Use below xml syntax to show

<img src="/iwesabe_sample/static/src/img/iWesabe-logo.png"/>


How to add Dynamic Images

In case you want to use an image that isn't static, here's what you can do instead.

<img t-att-src="'data:image/png;base64,%s' % to_text(product_id.image_medium)"/>


Here the product_id is an object and image_medium is image field(binary).

Then as Odoo renders by default binary data as base64, you can simply append the content of the image after base64,.



Hope this will help you !




If you wish to have the latest updates from us, you may follow us on FACEBOOKTWITTERYOUTUBE etc.