From 03c8d6a3bd0cc4553d96978db6d722347b6e633e Mon Sep 17 00:00:00 2001 From: Anand Kansagra Date: Mon, 31 Dec 2018 10:27:27 +0530 Subject: [PATCH] [MIG] web_widget_image_url: Migration to 12.0. --- web_widget_image_url/README.rst | 2 +- web_widget_image_url/__init__.py | 1 + web_widget_image_url/__manifest__.py | 2 +- web_widget_image_url/readme/CONTRIBUTORS.rst | 3 +++ web_widget_image_url/readme/DESCRIPTION.rst | 1 + web_widget_image_url/readme/USAGE.rst | 1 + .../static/src/js/web_widget_image_url.js | 14 ++++++------- .../static/src/xml/web_widget_image_url.xml | 20 +++++++++---------- 8 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 web_widget_image_url/readme/CONTRIBUTORS.rst create mode 100644 web_widget_image_url/readme/DESCRIPTION.rst create mode 100644 web_widget_image_url/readme/USAGE.rst diff --git a/web_widget_image_url/README.rst b/web_widget_image_url/README.rst index 28bd6132..abaff473 100644 --- a/web_widget_image_url/README.rst +++ b/web_widget_image_url/README.rst @@ -38,7 +38,7 @@ Contributors * Petar Najman * Sladjan Kantar - +* Anand Kansagra Maintainer ---------- diff --git a/web_widget_image_url/__init__.py b/web_widget_image_url/__init__.py index e69de29b..9a20a156 100644 --- a/web_widget_image_url/__init__.py +++ b/web_widget_image_url/__init__.py @@ -0,0 +1 @@ +# License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). diff --git a/web_widget_image_url/__manifest__.py b/web_widget_image_url/__manifest__.py index 30f31df3..205a59fb 100644 --- a/web_widget_image_url/__manifest__.py +++ b/web_widget_image_url/__manifest__.py @@ -4,7 +4,7 @@ "name": "Web Image URL", "summary": "This module provides web widget for displaying image from URL", "category": "Web", - "version": "11.0.1.0.0", + "version": "12.0.1.0.0", "license": "LGPL-3", "author": "Modoolar, Odoo Community Association (OCA)", "website": "https://github.com/OCA/web/", diff --git a/web_widget_image_url/readme/CONTRIBUTORS.rst b/web_widget_image_url/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..b22a1d32 --- /dev/null +++ b/web_widget_image_url/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Petar Najman +* Sladjan Kantar +* Anand Kansagra diff --git a/web_widget_image_url/readme/DESCRIPTION.rst b/web_widget_image_url/readme/DESCRIPTION.rst new file mode 100644 index 00000000..f4be39cf --- /dev/null +++ b/web_widget_image_url/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module provides web widget for displaying image from URL on form and tree views. diff --git a/web_widget_image_url/readme/USAGE.rst b/web_widget_image_url/readme/USAGE.rst new file mode 100644 index 00000000..69bf931f --- /dev/null +++ b/web_widget_image_url/readme/USAGE.rst @@ -0,0 +1 @@ +To use this module, you need to decorate xml field with widget ``image_url``. diff --git a/web_widget_image_url/static/src/js/web_widget_image_url.js b/web_widget_image_url/static/src/js/web_widget_image_url.js index 841d5a76..b9d1a200 100644 --- a/web_widget_image_url/static/src/js/web_widget_image_url.js +++ b/web_widget_image_url/static/src/js/web_widget_image_url.js @@ -2,12 +2,11 @@ // License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). odoo.define('web_widget_image_url.FieldImageURL', function (require) { -"use strict"; + "use strict"; var AbstractField = require('web.AbstractField'); var core = require('web.core'); var registry = require('web.field_registry'); - var QWeb = core.qweb; var _t = core._t; var UrlImage = AbstractField.extend({ @@ -16,20 +15,21 @@ odoo.define('web_widget_image_url.FieldImageURL', function (require) { placeholder: "/web/static/src/img/placeholder.png", supportedFieldTypes: ['char'], - url(){ + url: function () { return this.value ? this.value : this.placeholder; }, - _render() { + _render: function () { this._super(arguments); var self = this; var $img = this.$("img:first"); - $img.on('error', function() { + $img.on('error', function () { $img.attr('src', self.placeholder); - self.do_warn(_t("Image"), _t("Could not display the selected image.")); + self.do_warn( + _t("Image"), _t("Could not display the selected image.")); }); - } + }, }); registry.add('image_url', UrlImage); diff --git a/web_widget_image_url/static/src/xml/web_widget_image_url.xml b/web_widget_image_url/static/src/xml/web_widget_image_url.xml index 7ccd3020..8db6337e 100644 --- a/web_widget_image_url/static/src/xml/web_widget_image_url.xml +++ b/web_widget_image_url/static/src/xml/web_widget_image_url.xml @@ -4,14 +4,14 @@ # License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). --> - - - - - + + + + +