Odoo Help


6 Answers

Yenthe Van Ginneken Belgium

--Yenthe Van Ginneken--
| 9 9 12
Turnhout, Belgium
--Yenthe Van Ginneken--

My Odoo training platform: https://www.oocademy.com
My Odoo blog: http://www.odoo.yenthevg.com/
My Twitter: https://twitter.com/Yenthe666

Yenthe Van Ginneken Belgium
1/4/19, 2:15 AM

Hi Arthur,

By default the images are stored in the database in a base64 format so they're not really stored as an attachment. If you have the image as an attachment on the product you can create a public URL for it as you can look at the paths from the fields 'local_url' and 'website_url' (from the model ir.attachment) to make a full URL to your image(s). This way you could provide links but then you have to attach the images as an attachment on the products. I've added those two fields to the view from the ir.attachment model so that you can see how the path is built:

If you combine that path (so /web/image/2259?unique=4db4955a92a769b04b4320af6235fdccf8cdf016) with the basic URL of your website (in this case http://422032-11-0-fa8705.runbot15.odoo.com) you'll get a full URL to the image. Being http://422032-11-0-fa8705.runbot15.odoo.com/web/image/2259?unique=4db4955a92a769b04b4320af6235fdccf8cdf016 in this sample. The result after you navigate to this URL is your image:

I can't imagine that you're trying to connect with another ecommerce tool that has literally no way to get values through any protocol from another instance though. Are you really sure you can't? You can use xml-rpc to easily get the base64 images from any product in a matter of seconds.


arthur Brazil
1/9/19, 7:57 AM

Thanks for your response Yenthe, it helped clarifying things.

I was able to create attachments with the following function:

class ProductTemplate(models.Model):

_inherit = 'product.template'


def create_image_attachment(self, product):

image = self.env['ir.attachment'].create(dict(


name="Image - " + product.name,






return image

If I go to the product.template form view, I can download the attachments created and they are download correctly. However, if i try to download the image through the 'image_attachment.local_url', the file I download doesn't have the right name or extension.

Any idea of what I am missing?


arthur Brazil
1/9/19, 8:26 AM

Just managed to fix it. I just had to mimetype to 'image/jpeg'.

Still, the path provided by .local_url is not public. Is there a way I can make it public?

arthur Brazil
1/9/19, 8:26 AM

Just managed to fix it. I just had to mimetype to 'image/jpeg'.

Still, the path provided by .local_url is not public. Is there a way I can make it public?

5/13/19, 9:57 PM

I have same issue, is there any solution?

arthur Brazil
1/9/19, 8:49 AM

I managed to create the attachment and get its .local_url. However the route is also private. Is there a way can make it public?

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now