From 613e8b1f4a53605f1a36ea1b6cda85796944d8d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=BAria=20Mart=C3=ADn=20Xifr=C3=A9?= Date: Tue, 14 Jan 2020 11:30:23 +0100 Subject: [PATCH] [13.0][MIG] web_drop_target --- web_drop_target/__manifest__.py | 4 ++-- .../static/src/js/web_drop_target.js | 21 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/web_drop_target/__manifest__.py b/web_drop_target/__manifest__.py index da15ce314..af0da347d 100644 --- a/web_drop_target/__manifest__.py +++ b/web_drop_target/__manifest__.py @@ -2,13 +2,13 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Drop target support", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "author": "Therp BV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", "license": "AGPL-3", "category": "Usability", "summary": "Allows to drag files into Odoo", - "depends": ["web", "document"], + "depends": ["web"], "data": ["views/templates.xml"], "qweb": ["static/src/xml/widgets.xml"], } diff --git a/web_drop_target/static/src/js/web_drop_target.js b/web_drop_target/static/src/js/web_drop_target.js index 15cb91c72..980ea314d 100644 --- a/web_drop_target/static/src/js/web_drop_target.js +++ b/web_drop_target/static/src/js/web_drop_target.js @@ -7,11 +7,11 @@ odoo.define('web_drop_target', function(require) { var core = require('web.core'); var qweb = core.qweb; - // this is the main contribution of this addon: A mixin you can use - // to make some widget a drop target. Read on how to use this yourself + // This is the main contribution of this addon: A mixin you can use + // To make some widget a drop target. Read on how to use this yourself var DropTargetMixin = { - // add the mime types you want to support here, leave empty for - // all types. For more control, override _get_drop_items in your class + // Add the mime types you want to support here, leave empty for + // All types. For more control, override _get_drop_items in your class _drop_allowed_types: [], _drop_overlay: null, @@ -64,15 +64,15 @@ odoo.define('web_drop_target', function(require) { return drop_items; }, - // eslint-disable-next-line no-unused-vars + // Eslint-disable-next-line no-unused-vars _handle_drop_items: function(drop_items, e) { - // do something here, for example call the helper function below + // Do something here, for example call the helper function below // e is the on_load_end handler for the FileReader above, // so e.target.result contains an ArrayBuffer of the data }, _create_attachment: function(file, reader, e, res_model, res_id, extra_data) { - // helper to upload an attachment and update the sidebar + // Helper to upload an attachment and update the sidebar var self = this; return this._rpc({ model: 'ir.attachment', @@ -83,14 +83,13 @@ odoo.define('web_drop_target', function(require) { datas: base64js.fromByteArray( new Uint8Array(reader.result) ), - datas_fname: file.name, res_model: res_model, res_id: res_id, }, extra_data || {}) ], }) .then(function() { - // find the chatter among the children, there should be only + // Find the chatter among the children, there should be only // one var res = _.filter(self.getChildren(), 'chatter') if (res.length) { @@ -147,11 +146,11 @@ odoo.define('web_drop_target', function(require) { } }; - // and here we apply the mixin to form views, allowing any files and + // And here we apply the mixin to form views, allowing any files and // adding them as attachment FormController.include(_.extend(DropTargetMixin, { _get_drop_file: function() { - // disable drag&drop when we're on an unsaved record + // Disable drag&drop when we're on an unsaved record if (!this.datarecord.id) { return null; }