From 0d9db0eb38a0d6f4157303b988a76888dd72e7b2 Mon Sep 17 00:00:00 2001 From: kutyel Date: Fri, 22 Jul 2016 17:24:47 +0200 Subject: [PATCH] [MIG] web_widget_image_download --- web_widget_image_download/README.rst | 60 ++++++++++++++++++ web_widget_image_download/__init__.py | 3 + web_widget_image_download/__openerp__.py | 23 +++++++ .../static/description/icon.png | Bin 0 -> 17095 bytes .../src/css/web_widget_image_download.css | 6 ++ .../src/js/web_widget_image_download.js | 39 ++++++++++++ .../src/xml/web_widget_image_download.xml | 13 ++++ web_widget_image_download/views/assets.xml | 16 +++++ 8 files changed, 160 insertions(+) create mode 100644 web_widget_image_download/README.rst create mode 100644 web_widget_image_download/__init__.py create mode 100644 web_widget_image_download/__openerp__.py create mode 100644 web_widget_image_download/static/description/icon.png create mode 100644 web_widget_image_download/static/src/css/web_widget_image_download.css create mode 100644 web_widget_image_download/static/src/js/web_widget_image_download.js create mode 100644 web_widget_image_download/static/src/xml/web_widget_image_download.xml create mode 100644 web_widget_image_download/views/assets.xml diff --git a/web_widget_image_download/README.rst b/web_widget_image_download/README.rst new file mode 100644 index 00000000..cc5f3782 --- /dev/null +++ b/web_widget_image_download/README.rst @@ -0,0 +1,60 @@ +.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +=========================== +Web Widget - Image Download +=========================== + +This module was written to extend the functionality of the image widget and allows to download it. + +Usage +===== + +To use this module, you need to: + +#. Go to the section `Contacts`. +#. Click on a contact. +#. Edit the contact. +#. Click the `Download` button (between `Edit` and `Clear`). + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/162/8.0 + +Known Issues / Roadmap +====================== + +* In order to work correctly, this widget has to detect image type, the server should include this information in the `Content-Type` header. Right now, odoo is not doing so, but a fix has been `proposed `_. +* For some unknown reason, the widget does not work in the `Preferences` view, because odoo is not rendering the **QWeb** template. + +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. + +Credits +======= + +Contributors +------------ + +* Flavio Corpa + +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_widget_image_download/__init__.py b/web_widget_image_download/__init__.py new file mode 100644 index 00000000..c222227a --- /dev/null +++ b/web_widget_image_download/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Flavio Corpa +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). diff --git a/web_widget_image_download/__openerp__.py b/web_widget_image_download/__openerp__.py new file mode 100644 index 00000000..afc6d2f9 --- /dev/null +++ b/web_widget_image_download/__openerp__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Flavio Corpa +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +{ + "name": "Web Widget - Image Download", + "summary": "Allows to download any image from its widget", + "version": "9.0.1.0.0", + "category": "web", + "website": "https://www.tecnativa.com", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "LGPL-3", + "application": False, + "installable": True, + "data": [ + "views/assets.xml", + ], + "depends": [ + "web", + ], + "qweb": [ + "static/src/xml/web_widget_image_download.xml", + ] +} diff --git a/web_widget_image_download/static/description/icon.png b/web_widget_image_download/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..65dabfc969bb36290899d851f2262e6dba91d1c5 GIT binary patch literal 17095 zcmX_{bzB=y(D08CAV?udaS4H9MT=VrG-#3HR@@zmyBCL|#i6*n6{kho;!@lSE$;5T z{GRvuJb&CJmt1CdXXj=&GvA4LrzrgliyR98fM>EYNR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LMWlPi#7I8WjHnRt6R|^)}1hPJKCP9#}^MajNI*T(2Ye+ z)S6x3tGv`l6wz?R#Xi9D%F14knyahRjt_pW?z}&^Z6|Gis)_jC*O$TH^?5KdIvelX z*!o4)TPFaM1|MEfA~&uurlk!B0{kvDR$FPC9~ZSOZqXrybEEH5ECikF-;ZQ8N&de8 z-~k{0ZJ7uOSw#1=ByS*0aq#w5Vzby=h*Cc#9OAt)=KEj*(H!#ZSz)g)6mAkC9C@A_ zV^2=buCA_jCX>&fKebI$*GuQz{{H^s$B&m)B_ex!dzY72?~acnzD2Dyt)%Mnb??0{ z=HL0C)Z0>+Gy@S6=CqzK&d=J2nEl1{97HmgSz{?)nj20*&`ir>v6#>2v)PQuGE1ms z>`Ii9!xa=FI@Vot3BNsL1tU*76X3rV;r=sN!<51eqZvbn0B}0JoL)``#h_X)5irm4 z(P&f@Mbp&R*H`oT3;>Am;NV~~*;Ne?HCmEpg2s}gpf0J=y-NLweG00Oekyz=*ca6t3|n}%BpVax~_fCnR<}_CHgFs z*t0ClvwScd42nT9D6%ZeT&7B3!{-cHQIizOQ0B5m50sAuFc0ztqAH=KqM6I`JkRn> zcRrgp13AG2gS9F4j)VwEWoz<(+jIp6=4M7)1=!Ig! zf)_R#gdEU=e6b(^kwFZ8R*J!-g>WU105OW73va4 + * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ + +.openerp .oe_application a.oe_form_binary_file_download { + color: #eee; +} 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 new file mode 100644 index 00000000..6f204d13 --- /dev/null +++ b/web_widget_image_download/static/src/js/web_widget_image_download.js @@ -0,0 +1,39 @@ +/* + * Copyright 2016 Flavio Corpa + * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + */ +odoo.define('web_widget_image_download', function (require) { + 'use strict'; + + var common = require('web.form_common'); + + common.FieldBinaryImage.include({ + render_value: function () { + this._super(); + + var $widget = this.$el.find('.oe_form_binary_file_download'); + + this.imgSrc = this.$el.find('img[name="image"]').attr('src'); + + $.ajax({ + type: 'HEAD', + url: this.imgSrc, + complete: function (xhr) { + // retrieve image type from server ("Content-Type" header) + $widget.attr('download', xhr.getResponseHeader("Content-Type").replace('/', '.')); + } + }); + + // use jquery instead of `replace` with qweb (to avoid breaking inheritance) + if (this.has_custom_image()) { + this.$el.find('.oe_form_binary_file_clear').removeClass('col-md-offset-5'); + } + + $widget.attr('href', this.imgSrc); + }, + has_custom_image: function () { + // check if the image of the widget is different from the default placeholder + return this.imgSrc && !this.imgSrc.includes('/placeholder.png'); + } + }); +}); diff --git a/web_widget_image_download/static/src/xml/web_widget_image_download.xml b/web_widget_image_download/static/src/xml/web_widget_image_download.xml new file mode 100644 index 00000000..096d3256 --- /dev/null +++ b/web_widget_image_download/static/src/xml/web_widget_image_download.xml @@ -0,0 +1,13 @@ + + + + diff --git a/web_widget_image_download/views/assets.xml b/web_widget_image_download/views/assets.xml new file mode 100644 index 00000000..56fb5385 --- /dev/null +++ b/web_widget_image_download/views/assets.xml @@ -0,0 +1,16 @@ + + + + + +