diff --git a/web_tree_image/README.rst b/web_tree_image/README.rst new file mode 100644 index 00000000..61ae8274 --- /dev/null +++ b/web_tree_image/README.rst @@ -0,0 +1,59 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :alt: License: AGPL-3 + +===================================== +Display images and icons in tree view +===================================== + +This module defines a tree image widget, to be used with either binary fields +or (function) fields of type character. Use ``widget='image'`` in your view +definition. Optionally, set a ``width`` attribute. Default width is 30px. + +If you use the widget with a character field, the content of the field can be +any of the following: + +* The absolute or relative location of an image. For example, + "//static/src/img/youricon.png" + +* A standard icon from the web distribution, without path or extension, For + example, 'gtk-open' + +* A dynamic image in a data url base 64 format. Prefix with + 'data:image/png;base64,' + +Usage +===== + +Set the attribute ``widget=image`` in a ``field`` tag in a tree view. +You can also set ``height=`` to set the height the image will have. +Note that this just sets the CSS ``max-height`` attribute, +if you want to make the server return a resized, maybe to save data by making it +return a smaller one or to have uniform images, use the +``resize=","`` attribute. + +Credits +======= + +Contributors +------------ + +* Stefan Rijnhart +* Leonardo Donelli +* Jay Vora +* Meet Dholakia +* Nikul Chaudhary + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/web_tree_image/__init__.py b/web_tree_image/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_tree_image/__manifest__.py b/web_tree_image/__manifest__.py new file mode 100644 index 00000000..eb43f350 --- /dev/null +++ b/web_tree_image/__manifest__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Copyright 2014 Therp BV (). +# Copyright 2015 Leonardo Donelli @ MONKSoftware +# Copyright 2013 Marcel van der Boom +# Copyright 2016 - TODAY Serpent Consulting Services Pvt. Ltd. +# () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Show images in tree views', + 'version': '11.0.1.0.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', + 'depends': [ + 'web', + ], + 'data': [ + 'view/assets.xml', + ], + 'installable': True, +} diff --git a/web_tree_image/i18n/web_tree_image.pot b/web_tree_image/i18n/web_tree_image.pot new file mode 100644 index 00000000..b662aad9 --- /dev/null +++ b/web_tree_image/i18n/web_tree_image.pot @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + diff --git a/web_tree_image/static/description/icon.png b/web_tree_image/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_tree_image/static/description/icon.png differ diff --git a/web_tree_image/static/src/js/tooltip.js b/web_tree_image/static/src/js/tooltip.js new file mode 100644 index 00000000..a4a967bd --- /dev/null +++ b/web_tree_image/static/src/js/tooltip.js @@ -0,0 +1,18 @@ +odoo.define('web_tree_image.web_tree_image', function(require) { +"use strict"; + +var ListRenderer = require('web.ListRenderer'); + + ListRenderer.include({ + events: _.extend({}, ListRenderer.prototype.events, { + 'mouseover tbody tr td .o_field_image': '_onHoverRecord_img', + }), + _onHoverRecord_img: function (event) { + var img_src = $(event.currentTarget).children('.img-responsive').attr('src') + $(event.currentTarget).tooltip({ + title: "", + delay: 0, + }); + } + }); +}) diff --git a/web_tree_image/static/src/less/common.less b/web_tree_image/static/src/less/common.less new file mode 100644 index 00000000..cc57053a --- /dev/null +++ b/web_tree_image/static/src/less/common.less @@ -0,0 +1,3 @@ +.o_image_cell .o_field_image img{ + width:30px; +} diff --git a/web_tree_image/view/assets.xml b/web_tree_image/view/assets.xml new file mode 100644 index 00000000..9d40ab47 --- /dev/null +++ b/web_tree_image/view/assets.xml @@ -0,0 +1,11 @@ + + + +