[FIX] website: keep configurator images on theme switch

On theme switch default images of the previous theme are replaced
by the one of the new theme. For website where default images
come from the configurator we don't want them to be replaced by
the theme's images.

task-2614840

closes odoo/odoo#77648

X-original-commit: c25f80c70930f65a928b44d4fe91775c37bc4268
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Sébastien Mottet (oms)
2021-10-05 12:35:56 +00:00
parent fbedc9c0b9
commit aaef93c017
+8 -1
View File
@@ -457,7 +457,7 @@ class Website(models.Model):
except Exception as e:
logger.warning("Failed to download image: %s.\n%s", url, e)
else:
self.env['ir.attachment'].create({
attachment = self.env['ir.attachment'].create({
'name': name,
'website_id': website.id,
'key': name,
@@ -465,6 +465,13 @@ class Website(models.Model):
'raw': response.content,
'public': True,
})
self.env['ir.model.data'].create({
'name': 'configurator_%s_%s' % (website.id, name.split('.')[1]),
'module': 'website',
'model': 'ir.attachment',
'res_id': attachment.id,
'noupdate': True,
})
website = self.get_current_website()
theme_name = kwargs['theme_name']