diff --git a/web_tree_image/README.rst b/web_tree_image/README.rst index 4e96f8aa..40797dd9 100644 --- a/web_tree_image/README.rst +++ b/web_tree_image/README.rst @@ -41,6 +41,8 @@ Contributors * Stefan Rijnhart * Leonardo Donelli +* Jay Vora +* Meet Dholakia Maintainer ---------- diff --git a/web_tree_image/__openerp__.py b/web_tree_image/__openerp__.py index 05b692e7..86eb0eff 100644 --- a/web_tree_image/__openerp__.py +++ b/web_tree_image/__openerp__.py @@ -8,6 +8,9 @@ # Snippet from https://github.com/hsd/listview_images # Copyright (C) 2013 Marcel van der Boom # +# Copyright (C) 2016 Serpent Consulting Services Pvt. Ltd. +# () +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the @@ -24,8 +27,11 @@ ############################################################################## { 'name': 'Show images in tree views', - 'version': '8.0.1.1.0', - 'author': 'Therp BV, MONK Software, Odoo Community Association (OCA)', + 'version': '9.0.1.1.0', + 'author': "Therp BV, " + "MONK Software, " + "Odoo Community Association (OCA), " + "Serpent Consulting Services Pvt. Ltd.", 'website': 'https://github.com/OCA/Web', 'license': 'AGPL-3', 'category': 'Web', @@ -38,5 +44,5 @@ 'data': [ 'view/assets.xml', ], - 'installable': False, + 'installable': True, } diff --git a/web_tree_image/static/src/js/web_tree_image.js b/web_tree_image/static/src/js/web_tree_image.js index a533e583..92d02f12 100644 --- a/web_tree_image/static/src/js/web_tree_image.js +++ b/web_tree_image/static/src/js/web_tree_image.js @@ -2,6 +2,8 @@ OpenERP, Open Source Management Solution This module copyright (C) 2014 Therp BV () (C) 2013 Marcel van der Boom + Copyright (C) 2016 Serpent Consulting Services Pvt. Ltd. + () This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as @@ -17,8 +19,14 @@ along with this program. If not, see . */ -openerp.web_tree_image = function (instance) { - instance.web.list.Image = instance.web.list.Column.extend({ +odoo.define('web.tree_image', function (require) { + "use strict"; + var core = require('web.core'); + var session = require('web.session'); + var QWeb = core.qweb; + var list_widget_registry = core.list_widget_registry; + + var WebTreeImage = list_widget_registry.get('field.binary').extend({ format: function (row_data, options) { /* Return a valid img tag. For image fields, test if the field's value contains just the binary size and retrieve @@ -43,7 +51,7 @@ openerp.web_tree_image = function (instance) { if (this.resize) { imageArgs.resize = this.resize; } - src = instance.session.url('/web/binary/image', imageArgs); + src = session.url('/web/binary/image', imageArgs); } } else { if (!/\//.test(row_data[this.id].value)) { @@ -52,8 +60,10 @@ openerp.web_tree_image = function (instance) { src = row_data[this.id].value; } } - return instance.web.qweb.render('ListView.row.image', {widget: this, src: src}); + return QWeb.render('ListView.row.image', {widget: this, src: src}); } }); - instance.web.list.columns.add('field.image', 'instance.web.list.Image'); -}; + + list_widget_registry + .add('field.image', WebTreeImage) +});