How to print images in Custom QWeb reports in Odoo?

CSMaverick picture CSMaverick · Oct 26, 2015 · Viewed 11.1k times · Source

I would like to display images which are uploaded by users in my custom Qweb reports.

Which is the best way to do that?

Answer

ChesuCR picture ChesuCR · Oct 27, 2015

If you want to show an image from the database you can just use the image widget like this:

<span t-field="o.image_field_name" t-field-options='{"widget": "image"}'/>

And if you want to show an image stored as a file:

<img t-att-src="'/module_name/static/src/img/image_name.png'" />

Note: respect the order and the type of the quotes