Apply changes

This commit is contained in:
difusionvisual 2017-06-06 16:26:26 +01:00
parent ea8ebcdfbf
commit b5961b883a
4 changed files with 11 additions and 8 deletions

View File

@ -31,7 +31,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/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 <https://github.com/OCA/knowledge/issues/new?body=module:%20document_url%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`here <https://github.com/OCA/knowledge/issues/new?body=module:%20document_url%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======

View File

@ -1,3 +1,8 @@
/* © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* © 2016 ACSONE SA/NV (<http://acsone.eu>)
* 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');

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-extend="Sidebar">
<!-- oe_ for Odoo CE, and o_ for Odoo EE -->

View File

@ -2,7 +2,7 @@
# © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
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