diff --git a/document_url/README.rst b/document_url/README.rst index 0766dd80dc3..5a6f6803be6 100644 --- a/document_url/README.rst +++ b/document_url/README.rst @@ -23,7 +23,7 @@ To use this module, you need to: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/118/9.0 + :target: https://runbot.odoo-community.org/runbot/118/10.0 Bug Tracker =========== @@ -31,7 +31,7 @@ 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 -`here `_. +`here `_. Credits ======= @@ -40,7 +40,7 @@ Contributors ------------ * Jonathan Nemry -* Pedro M. Baeza Maintainer ---------- diff --git a/document_url/__manifest__.py b/document_url/__manifest__.py index 2d4e0a07e7d..d08bbb5f351 100644 --- a/document_url/__manifest__.py +++ b/document_url/__manifest__.py @@ -4,7 +4,7 @@ # © 2016 ACSONE SA/NV () { 'name': 'URL attachment', - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'category': 'Tools', 'author': "Tecnativa," "Odoo Community Association (OCA)", @@ -19,5 +19,5 @@ 'qweb': [ 'static/src/xml/url.xml', ], - 'installable': False, + 'installable': True, } diff --git a/document_url/static/src/js/url.js b/document_url/static/src/js/url.js old mode 100644 new mode 100755 index 0eaefa478c4..8261b094ba6 --- a/document_url/static/src/js/url.js +++ b/document_url/static/src/js/url.js @@ -4,53 +4,27 @@ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ odoo.define('document_url', function(require) { - - var core = require('web.core'); + "use strict"; var Sidebar = require('web.Sidebar'); - var ActionManager = require('web.ActionManager'); - - var _t = core._t, - QWeb = core.qweb; Sidebar.include({ - redraw: function() { - var self = this; - this._super.apply(this, arguments); - self.$el.find("a[href]").attr('target', '_blank'); - self.$el.find('.oe_sidebar_add_attachment, .o_sidebar_add_attachment').after(QWeb.render('AddUrlDocumentItem', {widget: self})) - self.$el.find('.oe_sidebar_add_url').on('click', function (e) { - self.on_url_doc(); - }); - }, - on_url_doc: function() { - var self = this; - var view = self.getParent(); - var ids = ( view.fields_view.type != "form" )? view.groups.get_selection().ids : [ view.datarecord.id ]; - if( !_.isEmpty(ids) ){ - view.sidebar_eval_context().done(function (context) { - self.rpc("/web/action/load", { action_id: "document_url.action_ir_attachment_add_url" }).done(function(result) { - self.getParent().do_action(result, { - additional_context: { - 'active_ids': ids, - 'active_id': [ids[0]], - 'active_model': view.dataset.model, - }, - }); - }); - }); - } + init: function (parent, options) { + var result = this._super(parent, options); + this.items.url_doc = [ + { + action: { + id: "document_url.action_ir_attachment_add_url" + } + } + ]; + return result; }, - }); - ActionManager = ActionManager.include({ - ir_actions_act_close_wizard_and_reload_view: function (action, options) { - if (!this.dialog) { - options.on_close(); - } - this.dialog_stop(); - this.inner_widget.views[this.inner_widget.active_view.type].controller.reload(); - return $.when(); - }, + redraw: function () { + var result = this._super(); + // Open URLs in a different browser tab + this.$el.find("a[href]").attr('target', '_blank'); + return result; + } }); - }); diff --git a/document_url/static/src/xml/url.xml b/document_url/static/src/xml/url.xml index f55fbc388c6..a8f73d91a62 100644 --- a/document_url/static/src/xml/url.xml +++ b/document_url/static/src/xml/url.xml @@ -1,8 +1,15 @@ - - -
  • - Add URL... -
  • -
    + + + + +
  • + Add URL... +
  • +
    +
    diff --git a/document_url/view/document_url_view.xml b/document_url/view/document_url_view.xml index e8bd2c10f2f..5382567143b 100644 --- a/document_url/view/document_url_view.xml +++ b/document_url/view/document_url_view.xml @@ -1,7 +1,5 @@ - - - +