Odoo Help


How to display uploaded image in tree view

mihir shah
on 4/25/13, 8:08 AM 6,308 views

I'm facing a problem , I am uploading images according to category wise , now I have to display all images category wise in tree view. What's the syntax to display image in tree view

Marcel van der Boom
On 9/24/13, 7:21 AM

It's perfectly possible to display images in list/tree view. Some js code has to be added to add this functionality.

I created a small module which does exactly this. The module has just one file which is relevant.


openerp.listview_images = function(instance) { 

/* Add a new mapping to the registry for image fields */

/* Define a method similar to the one for forms to render image fields */
instance.web.list.FieldBinaryImage = instance.web.list.Column.extend({
 * Return a image to the binary field of specified as widget image
 * @private
_format: function (row_data, options) {
        var placeholder = "/web/static/src/img/placeholder.png";
        var value = row_data[this.id].value;
        var img_url = placeholder;

        if (value && value.substr(0, 10).indexOf(' ') == -1) {
    /* Data inline */
    /* FIXME: can we get the mimetype from the data? */
    img_url = "data:image/png;base64," + value;
    } else {
    /* Data by URI (presumably slow) */
    img_url = instance.session.url('/web/binary/image', {model: options.model, field: this.id, id: options.id});
    /* FIXME: move the 30px stuff to something templateable */
    return _.template('<image src="<%-src%>" width="30px" height="30px"/>', {
    src: img_url,

The module is available on github, but I can't post link. [github.com / hsd / listview-images]

Thanx a lot Sir.......it worked out to be really good!!!!

Shivam Goyal
on 4/18/14, 9:25 AM



| 6 5 7
Buenos Aires, Argentina
Karma will give me a place in heaven!
On 4/25/13, 10:12 AM

In tree view, is it not possible to add images, as stated in the other answer.

But, what you can do, as a workaround, is define your image as the icon (.png) of a button, and then, add the button without any action to the tree view.

It is not elegant, but is the only way I found to make something like this. Obviously, the image will be small and all, but, well, is something...

Hope it helps!

Hi Lucio, your solution is correct, now my question is how you define a product image as a button icon?

on 5/23/13, 4:33 PM

Francesco OpenCode

--Francesco OpenCode--

| 6 8 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 4/25/13, 8:19 AM

You can't show image in tree view. If you want you can create a Kanban view and insert the image inside. To see how a Kanban view works, you can see as example the partner view.

what if we dont want kanban view , but den also want display the image . is it possible in openerp v7

mihir shah
on 4/25/13, 8:53 AM

In this case you can create a kanban view with images only. In tree this impossibile.

Francesco OpenCode
on 4/25/13, 8:55 AM

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

2 follower(s)


Asked: 4/25/13, 8:08 AM
Seen: 6308 times
Last updated: 10/24/17, 6:12 AM