Browse Source

Migrated web tree image module to v9

pull/1279/merge
Serpent Consulting Services Pvt. Ltd 9 years ago
committed by OCA-git-bot
parent
commit
42d24e488a
  1. 2
      web_tree_image/README.rst
  2. 12
      web_tree_image/__openerp__.py
  3. 22
      web_tree_image/static/src/js/web_tree_image.js

2
web_tree_image/README.rst

@ -41,6 +41,8 @@ Contributors
* Stefan Rijnhart
* Leonardo Donelli <donelli@webmonks.it>
* Jay Vora <jay.vora@serpentcs.com>
* Meet Dholakia <m.dholakia.serpentcs@gmail.com>
Maintainer
----------

12
web_tree_image/__openerp__.py

@ -8,6 +8,9 @@
# Snippet from https://github.com/hsd/listview_images
# Copyright (C) 2013 Marcel van der Boom <marcel@hsdev.com>
#
# Copyright (C) 2016 Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
#
# 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,
}

22
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 (<http://therp.nl>)
(C) 2013 Marcel van der Boom <marcel@hsdev.com>
Copyright (C) 2016 Serpent Consulting Services Pvt. Ltd.
(<http://www.serpentcs.com>)
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 <http://www.gnu.org/licenses/>.
*/
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)
});
Loading…
Cancel
Save