0

I am currently trying to add a static image into an Odoo v10 report. In Odoo v8, I used the image tag with the path like this:

<field src="/my_module/static/src/img/my_image.png"/>

But in Odoo v10 it does only display an empty rectangle.

Has it been changed in v10 or am I doing something wrong? The path and the name of the file is correct.

Greetings, Matthias

  • Check this https://stackoverflow.com/questions/28561121/how-to-display-an-image-in-a-qweb-report/28628727#28628727 – Kenly May 28 '17 at 13:51
  • I've seen this post too. This is exactly what I am doing. I've also tried to add those classes to the field, but with no effect. EDIT: This also seems to be an Odoo v8 post (The author writes about a openerp.py file). In v8 this method works, but in v10 not. – Matthias Schild May 28 '17 at 14:28
  • This is how I added the image to my report ``. I used the link above. – Kenly May 29 '17 at 11:12

2 Answers2

0

First of all image you want to display is static image not the field so try image tag:

<img src="my_module/static/src/img/my_image.png'/>
Alpesh Valaki
  • 1,611
  • 1
  • 16
  • 36
0

This is working for me to display a background image:

<div class="page" t-attf-style="background-
image:url('/my_module/static/src/img/my_image.jpg');">

Make sure that when you go to (your server's url)/my_module/static/src/img/my_image.jpg in your browser, you can see the image.

So you could do an empty div with your image as background in the place you want your image.

Almir
  • 1
  • 4