diff --git a/setup/web_widget_image_download/odoo/addons/web_widget_image_download b/setup/web_widget_image_download/odoo/addons/web_widget_image_download new file mode 120000 index 000000000..ab050eae8 --- /dev/null +++ b/setup/web_widget_image_download/odoo/addons/web_widget_image_download @@ -0,0 +1 @@ +../../../../web_widget_image_download \ No newline at end of file diff --git a/setup/web_widget_image_download/setup.py b/setup/web_widget_image_download/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_widget_image_download/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_widget_image_download/static/src/js/web_widget_image_download.js b/web_widget_image_download/static/src/js/web_widget_image_download.js index 996139f2f..d78a3d4ff 100644 --- a/web_widget_image_download/static/src/js/web_widget_image_download.js +++ b/web_widget_image_download/static/src/js/web_widget_image_download.js @@ -1,13 +1,13 @@ /* Copyright 2016 Flavio Corpa * Copyright 2016 Jairo Llopis * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ -odoo.define("web_widget_image_download.widget", function(require) { +odoo.define("web_widget_image_download.widget", function (require) { "use strict"; var FieldBinaryImage = require("web.basic_fields").FieldBinaryImage; FieldBinaryImage.include({ - _render: function() { + _render: function () { this._super(); var $widget = this.$el.find(".o_form_binary_file_download"); this.imgSrc = this.$el.find('img[name="' + this.name + '"]').attr("src"); @@ -16,7 +16,7 @@ odoo.define("web_widget_image_download.widget", function(require) { // Avoid downloading full image, just headers type: "HEAD", url: this.imgSrc, - complete: function(xhr) { + complete: function (xhr) { $widget.attr( "download", xhr.getResponseHeader("Content-Type").replace("/", ".")