Odoo Help


How to use urls as product images?

Michael Schmidt
on 5/8/13, 1:13 PM 8,562 views

How can I use urls instead of binary data for the product images? Or, if not possible, how to use the filesystem instead of the database for product images?

I know how to do it with attachments, but how does it work with product images?

Thanks for any proper answer...

did you meant to get an image from a url entered and show in binary field?

dianne jose
on 7/4/13, 4:45 AM
dianne jose
On 7/4/13, 7:33 AM

if you meant to get an image from a given url: the python code and xml is as follows: python:

import base64#file encode
import urllib2 #file download from url

class image_url(osv.osv):
               'web':fields.char('image url', help='Automatically sanitized HTML contents'),
    def onchange_image(self,cr,uid,ids,web,context=None):
        photo = base64.encodestring(urllib2.urlopen(link).read())
        return {'value': val}

xml view:

<record id="view_mrk_form" model="ir.ui.view">
            <field name="name">mark.marksheet.form</field>
            <field name="model">mark.marksheet</field>
            <field name="arch" type="xml">
            <form string="image">
                 <field name="image" widget="image" width="110" height="70" />
                 <field name="web" widget="url" on_change="onchange_image(web,context)"/>

Perfect..Thank You so much.. It helped a lot.

Chandni Machchhar
on 1/7/14, 3:56 AM

@Chandni, thank you for your detailed explanation. Do you have a github repository that I can fork this module from? I would like to include it as a dependency in an open-source theme module i'm building and would like to make sure I accredit you correctly.

Luke Branch
on 11/12/14, 1:19 AM
On 7/2/13, 7:18 AM

You have to check the link option and indicate your file location.

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

Question tools

3 follower(s)


Asked: 5/8/13, 1:13 PM
Seen: 8562 times
Last updated: 11/8/17, 5:23 PM