diff --git a/setup/web_tree_image_tooltip/odoo/addons/web_tree_image_tooltip b/setup/web_tree_image_tooltip/odoo/addons/web_tree_image_tooltip new file mode 120000 index 000000000..50c98a367 --- /dev/null +++ b/setup/web_tree_image_tooltip/odoo/addons/web_tree_image_tooltip @@ -0,0 +1 @@ +../../../../web_tree_image_tooltip \ No newline at end of file diff --git a/setup/web_tree_image_tooltip/setup.py b/setup/web_tree_image_tooltip/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_tree_image_tooltip/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_tree_image_tooltip/README.rst b/web_tree_image_tooltip/README.rst new file mode 100644 index 000000000..9fc3e6e6f --- /dev/null +++ b/web_tree_image_tooltip/README.rst @@ -0,0 +1,97 @@ +===================================== +Show images in tree views via tooltip +===================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/14.0/web_tree_image_tooltip + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_tree_image_tooltip + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module defines a images and icons in tree view via Tooltip. +Additionally, Default width with 30px. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Insert `widget='image'` in your field view definition in any image field + +Usage +===== + +Mouse Hover in tree view image that time Tooltip effect. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Therp BV +* MONK Software +* Serpent Consulting Services Pvt. Ltd. + +Contributors +~~~~~~~~~~~~ + +* Stefan Rijnhart +* Leonardo Donelli +* Jay Vora +* Meet Dholakia +* Nikul Chaudhary +* Phuc Tran Thanh +* Tharathip Chaweewongphan + +Other credits +~~~~~~~~~~~~~ + +* Serpent Consulting Services Pvt. Ltd. + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_tree_image_tooltip/__init__.py b/web_tree_image_tooltip/__init__.py new file mode 100644 index 000000000..6d4f4bde9 --- /dev/null +++ b/web_tree_image_tooltip/__init__.py @@ -0,0 +1 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/web_tree_image_tooltip/__manifest__.py b/web_tree_image_tooltip/__manifest__.py new file mode 100644 index 000000000..e88fb052b --- /dev/null +++ b/web_tree_image_tooltip/__manifest__.py @@ -0,0 +1,30 @@ +# 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 via tooltip", + "version": "15.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": [], + "demo": [ + "demo/view_res_users.xml", + ], + "assets": { + "web.assets_backend": [ + "web_tree_image_tooltip/static/src/scss/common.scss", + "web_tree_image_tooltip/static/src/js/tooltip.js", + ], + }, + "installable": True, +} diff --git a/web_tree_image_tooltip/demo/view_res_users.xml b/web_tree_image_tooltip/demo/view_res_users.xml new file mode 100644 index 000000000..94535d8f4 --- /dev/null +++ b/web_tree_image_tooltip/demo/view_res_users.xml @@ -0,0 +1,17 @@ + + + + res.users + + + + + + + + diff --git a/web_tree_image_tooltip/i18n/web_tree_image.pot b/web_tree_image_tooltip/i18n/web_tree_image.pot new file mode 100644 index 000000000..447d3bb3c --- /dev/null +++ b/web_tree_image_tooltip/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 11.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_tooltip/i18n/web_tree_image_tooltip.pot b/web_tree_image_tooltip/i18n/web_tree_image_tooltip.pot new file mode 100644 index 000000000..4d8b20f91 --- /dev/null +++ b/web_tree_image_tooltip/i18n/web_tree_image_tooltip.pot @@ -0,0 +1,13 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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_tooltip/i18n/zh_CN.po b/web_tree_image_tooltip/i18n/zh_CN.po new file mode 100644 index 000000000..e69de29bb diff --git a/web_tree_image_tooltip/readme/CONFIGURE.rst b/web_tree_image_tooltip/readme/CONFIGURE.rst new file mode 100644 index 000000000..11a612f60 --- /dev/null +++ b/web_tree_image_tooltip/readme/CONFIGURE.rst @@ -0,0 +1,14 @@ +Insert `widget='image'` in your field view definition in any image field + +.. code:: xml + + + + +If the model has different fields of the same image with different size +(as ``product.product`` for instance with ``image``, ``image_medium``, ``image_small``), +you can write the following code to reduce the load duration of the tree view. + +.. code:: xml + + diff --git a/web_tree_image_tooltip/readme/CONTRIBUTORS.rst b/web_tree_image_tooltip/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..ce2d46287 --- /dev/null +++ b/web_tree_image_tooltip/readme/CONTRIBUTORS.rst @@ -0,0 +1,8 @@ +* Stefan Rijnhart +* Leonardo Donelli +* Jay Vora +* Meet Dholakia +* Nikul Chaudhary +* Phuc Tran Thanh +* Tharathip Chaweewongphan +* Sylvain LE GAL (https://www.twitter.com/legalsylvain) diff --git a/web_tree_image_tooltip/readme/CREDITS.rst b/web_tree_image_tooltip/readme/CREDITS.rst new file mode 100644 index 000000000..09b1864e3 --- /dev/null +++ b/web_tree_image_tooltip/readme/CREDITS.rst @@ -0,0 +1 @@ +* Serpent Consulting Services Pvt. Ltd. diff --git a/web_tree_image_tooltip/readme/DESCRIPTION.rst b/web_tree_image_tooltip/readme/DESCRIPTION.rst new file mode 100644 index 000000000..2796f0353 --- /dev/null +++ b/web_tree_image_tooltip/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module defines a images and icons in tree view via Tooltip. +Additionally, Default width with 30px. + +.. image:: ../static/description/tree_view_image.png diff --git a/web_tree_image_tooltip/readme/USAGE.rst b/web_tree_image_tooltip/readme/USAGE.rst new file mode 100644 index 000000000..037ec3259 --- /dev/null +++ b/web_tree_image_tooltip/readme/USAGE.rst @@ -0,0 +1,3 @@ +Mouse Hover in tree view image that time Tooltip effect. + +.. image:: ../static/description/tree_view_image_tooltip.png diff --git a/web_tree_image_tooltip/static/description/icon.png b/web_tree_image_tooltip/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/web_tree_image_tooltip/static/description/icon.png differ diff --git a/web_tree_image_tooltip/static/description/index.html b/web_tree_image_tooltip/static/description/index.html new file mode 100644 index 000000000..6fdd241b0 --- /dev/null +++ b/web_tree_image_tooltip/static/description/index.html @@ -0,0 +1,445 @@ + + + + + + +Show images in tree views via tooltip + + + +
+

Show images in tree views via tooltip

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

This module defines a images and icons in tree view via Tooltip. +Additionally, Default width with 30px.

+

Table of contents

+ +
+

Configuration

+

Insert widget=’image’ in your field view definition in any image field

+
+
+

Usage

+

Mouse Hover in tree view image that time Tooltip effect.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Therp BV
  • +
  • MONK Software
  • +
  • Serpent Consulting Services Pvt. Ltd.
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_tree_image_tooltip/static/description/tree_view_image.png b/web_tree_image_tooltip/static/description/tree_view_image.png new file mode 100644 index 000000000..efbd51cbd Binary files /dev/null and b/web_tree_image_tooltip/static/description/tree_view_image.png differ diff --git a/web_tree_image_tooltip/static/description/tree_view_image_tooltip.png b/web_tree_image_tooltip/static/description/tree_view_image_tooltip.png new file mode 100644 index 000000000..22b8c2ead Binary files /dev/null and b/web_tree_image_tooltip/static/description/tree_view_image_tooltip.png differ diff --git a/web_tree_image_tooltip/static/src/js/tooltip.js b/web_tree_image_tooltip/static/src/js/tooltip.js new file mode 100644 index 000000000..b0008cc1f --- /dev/null +++ b/web_tree_image_tooltip/static/src/js/tooltip.js @@ -0,0 +1,46 @@ +odoo.define("web_tree_image_tooltip.web_tree_image_tooltip", function (require) { + "use strict"; + + var session = require("web.session"); + var field_utils = require("web.field_utils"); + var FieldBinaryImage = require("web.basic_fields").FieldBinaryImage; + var ListRenderer = require("web.ListRenderer"); + + FieldBinaryImage.include({ + _render: function () { + this._super(); + if (this.nodeOptions.tooltip_image) { + var image_src = session.url("/web/image", { + model: this.model, + id: JSON.stringify(this.res_id), + field: this.nodeOptions.tooltip_image, + // Unique forces a reload of the image when the record has been updated + unique: field_utils.format + .datetime(this.recordData.__last_update) + .replace(/[^0-9]/g, ""), + }); + this.$(".img-fluid")[0].setAttribute("tooltip-image-src", image_src); + } + }, + }); + + 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-fluid") + .attr("tooltip-image-src") || + $(event.currentTarget).children(".img-fluid").attr("src"); + + $(event.currentTarget) + .tooltip({ + title: "", + delay: 0, + }) + .tooltip("show"); + }, + }); +}); diff --git a/web_tree_image_tooltip/static/src/scss/common.scss b/web_tree_image_tooltip/static/src/scss/common.scss new file mode 100644 index 000000000..600f7beb8 --- /dev/null +++ b/web_tree_image_tooltip/static/src/scss/common.scss @@ -0,0 +1,8 @@ +.o_image_cell .o_field_image img { + width: 30px; +} + +.tooltip_image { + max-width: 80vw; + max-height: 80vh; +}