mirror of https://github.com/OCA/web.git
Merge pull request #290 from JayVora-SerpentCS/9.0
[MIG]Migrated web tree image in v9.pull/356/head
commit
93dd19fded
|
@ -41,6 +41,8 @@ Contributors
|
||||||
|
|
||||||
* Stefan Rijnhart
|
* Stefan Rijnhart
|
||||||
* Leonardo Donelli <donelli@webmonks.it>
|
* Leonardo Donelli <donelli@webmonks.it>
|
||||||
|
* Jay Vora <jay.vora@serpentcs.com>
|
||||||
|
* Meet Dholakia <m.dholakia.serpentcs@gmail.com>
|
||||||
|
|
||||||
Maintainer
|
Maintainer
|
||||||
----------
|
----------
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
# Snippet from https://github.com/hsd/listview_images
|
# Snippet from https://github.com/hsd/listview_images
|
||||||
# Copyright (C) 2013 Marcel van der Boom <marcel@hsdev.com>
|
# 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
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
@ -24,8 +27,11 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
{
|
{
|
||||||
'name': 'Show images in tree views',
|
'name': 'Show images in tree views',
|
||||||
'version': '8.0.1.1.0',
|
'version': '9.0.1.1.0',
|
||||||
'author': 'Therp BV, MONK Software, Odoo Community Association (OCA)',
|
'author': "Therp BV, "
|
||||||
|
"MONK Software, "
|
||||||
|
"Odoo Community Association (OCA), "
|
||||||
|
"Serpent Consulting Services Pvt. Ltd.",
|
||||||
'website': 'https://github.com/OCA/Web',
|
'website': 'https://github.com/OCA/Web',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'category': 'Web',
|
'category': 'Web',
|
||||||
|
@ -38,5 +44,5 @@
|
||||||
'data': [
|
'data': [
|
||||||
'view/assets.xml',
|
'view/assets.xml',
|
||||||
],
|
],
|
||||||
'installable': False,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
OpenERP, Open Source Management Solution
|
OpenERP, Open Source Management Solution
|
||||||
This module copyright (C) 2014 Therp BV (<http://therp.nl>)
|
This module copyright (C) 2014 Therp BV (<http://therp.nl>)
|
||||||
(C) 2013 Marcel van der Boom <marcel@hsdev.com>
|
(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
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as
|
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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
openerp.web_tree_image = function (instance) {
|
odoo.define('web.tree_image', function (require) {
|
||||||
instance.web.list.Image = instance.web.list.Column.extend({
|
"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) {
|
format: function (row_data, options) {
|
||||||
/* Return a valid img tag. For image fields, test if the
|
/* Return a valid img tag. For image fields, test if the
|
||||||
field's value contains just the binary size and retrieve
|
field's value contains just the binary size and retrieve
|
||||||
|
@ -43,7 +51,7 @@ openerp.web_tree_image = function (instance) {
|
||||||
if (this.resize) {
|
if (this.resize) {
|
||||||
imageArgs.resize = this.resize;
|
imageArgs.resize = this.resize;
|
||||||
}
|
}
|
||||||
src = instance.session.url('/web/binary/image', imageArgs);
|
src = session.url('/web/binary/image', imageArgs);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!/\//.test(row_data[this.id].value)) {
|
if (!/\//.test(row_data[this.id].value)) {
|
||||||
|
@ -52,8 +60,10 @@ openerp.web_tree_image = function (instance) {
|
||||||
src = row_data[this.id].value;
|
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…
Reference in New Issue