mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-26 18:38:41 -06:00
Fixed review
This commit is contained in:
parent
a63f0b3dbf
commit
ea8ebcdfbf
@ -41,8 +41,6 @@ Contributors
|
|||||||
|
|
||||||
* Jonathan Nemry <jonathan.nemry@acsone.eu>
|
* Jonathan Nemry <jonathan.nemry@acsone.eu>
|
||||||
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
||||||
* Nicolás Ramos <contacto@difusionvisual.com>
|
|
||||||
* Antonio Cánovas <antonio.canovas@ingenieriacloud.com>
|
|
||||||
|
|
||||||
Maintainer
|
Maintainer
|
||||||
----------
|
----------
|
||||||
|
@ -21,20 +21,20 @@ class AddUrlWizard(models.TransientModel):
|
|||||||
"""Adds the URL with the given name as an ir.attachment record."""
|
"""Adds the URL with the given name as an ir.attachment record."""
|
||||||
|
|
||||||
context = self.env.context
|
context = self.env.context
|
||||||
if not context.get('active_model'):
|
if not context['active_model']:
|
||||||
return
|
return
|
||||||
attachment_obj = self.env['ir.attachment']
|
attachment_obj = self.env['ir.attachment']
|
||||||
for form in self:
|
for form in self:
|
||||||
url = urlparse(form.url)
|
url = urlparse(form.url)
|
||||||
if not url.scheme:
|
if not url.scheme:
|
||||||
url = urlparse('%s%s' % ('http://', form.url))
|
url = urlparse('%s%s' % ('http://', form.url))
|
||||||
for active_id in context.get('active_ids', []):
|
for active_id in context['active_ids', []]:
|
||||||
attachment = {
|
attachment = {
|
||||||
'name': form.name,
|
'name': form.name,
|
||||||
'type': 'url',
|
'type': 'url',
|
||||||
'url': url.geturl(),
|
'url': url.geturl(),
|
||||||
'res_id': active_id,
|
'res_id': active_id,
|
||||||
'res_model': context.get('active_model')
|
'res_model': context['active_model']
|
||||||
}
|
}
|
||||||
attachment_obj.create(attachment)
|
attachment_obj.create(attachment)
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user