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