This question has been flagged
2 Replies
6565 Views

Hi all,

This is code :

"product_view.xml"

<record id="product_category_tree_view" model="ir.ui.view">

       <field name="name">product.category.tree</field>

        <field name="model">product.category</field>

        <field name="field_parent">child_id</field>

        <field name="arch" type="xml">

            <tree toolbar="True" string="Product Categories">

                <field name="image" widget="image"/>

                <field name="name"/>

            </tree>

     </field>

</record>

field image in class product_category()

'image': fields.binary("Image",help="This field holds the image used as image for the product, limited to 1024x1024px."),

"file product.js"

openerp.product = function(instance) {

instance.web.list.Binary.include({

    _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) {

            img_url = "data:image/png;base64," + value;

        } else {

            img_url = instance.session.url('/web/binary/image', {model: options.model, field: this.id, id: options.id});

        }

        return _.template('<image src="<%-src%>" width="80px"/>', {

            src: img_url

        });

    }

});

}

when I click on the "Products by Category", then it does:

this is show

___________________Image__________I__________Name

jdhdkjashdkashdkashdkas______ l__________ Category 1

jhskjdahsdkashkdashkkadjkas __l __________Category 2

i want colum image show image thumb ?

Avatar
Discard
Best Answer

Can add image in list view with the link

https://accounts.openerp.com/forum/Help-1/question/483

Avatar
Discard
Best Answer

Try this module: listview_images

Avatar
Discard