Search code examples
xmlimagereportodooqweb

How to print images in Custom QWeb reports in Odoo?


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

Which is the best way to do that?


Solution

  • 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