[FIX] base_import_module: no spaces in ir_model_data name

When we are importing a module and we need to create an attachment from
a file in static. We get an error if the file path of the file contains
a space.

We get this error becuase it takes the path to generate an xml id and
the name of an xml_id cannot contains spaces.

closes odoo/odoo#142113

Signed-off-by: Pierre Masereel (pim) <pim@odoo.com>
This commit is contained in:
Pierre Masereel
2023-11-15 12:34:24 +00:00
parent 0bf36e107a
commit 307a2e0363
@@ -148,7 +148,7 @@ class IrModule(models.Model):
else:
attachment = IrAttachment.create(values)
self.env['ir.model.data'].create({
'name': f"attachment_{url_path}".replace('.', '_'),
'name': f"attachment_{url_path}".replace('.', '_').replace(' ', '_'),
'model': 'ir.attachment',
'module': module,
'res_id': attachment.id,