diff --git a/document_url/README.rst b/document_url/README.rst index 9f97ed99..5a6f6803 100644 --- a/document_url/README.rst +++ b/document_url/README.rst @@ -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 ======= diff --git a/document_url/static/src/js/url.js b/document_url/static/src/js/url.js index c5ee7358..595a6e7d 100644 --- a/document_url/static/src/js/url.js +++ b/document_url/static/src/js/url.js @@ -1,3 +1,8 @@ +/* © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) + * Pedro M. Baeza + * © 2016 ACSONE SA/NV () + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + */ odoo.define('document_url', function(require) { "use strict"; var Sidebar = require('web.Sidebar'); @@ -22,4 +27,4 @@ odoo.define('document_url', function(require) { return result; }, }); -}); \ No newline at end of file +}); diff --git a/document_url/static/src/xml/url.xml b/document_url/static/src/xml/url.xml index b76722d3..a8f73d91 100644 --- a/document_url/static/src/xml/url.xml +++ b/document_url/static/src/xml/url.xml @@ -1,5 +1,4 @@ - diff --git a/document_url/wizard/document_url.py b/document_url/wizard/document_url.py index 5583fbaa..aa1431e2 100644 --- a/document_url/wizard/document_url.py +++ b/document_url/wizard/document_url.py @@ -2,7 +2,7 @@ # © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) # Pedro M. Baeza # © 2016 ACSONE SA/NV () -from odoo import models, fields, api +from odoo import models, fields, api, _ try: # Python 3 from urllib import parse as urlparse @@ -20,21 +20,20 @@ class AddUrlWizard(models.TransientModel): def action_add_url(self): """Adds the URL with the given name as an ir.attachment record.""" - context = self.env.context - if not context['active_model']: + if not self._context.get('active_model'): return attachment_obj = self.env['ir.attachment'] for form in self: url = urlparse(form.url) if not url.scheme: url = urlparse('%s%s' % ('http://', form.url)) - for active_id in context['active_ids', []]: + for active_id in self._context.get('active_ids', []): attachment = { 'name': form.name, 'type': 'url', 'url': url.geturl(), 'res_id': active_id, - 'res_model': context['active_model'] + 'res_model': self._context.get('active_model') } attachment_obj.create(attachment) return False