[FIX] website_theme_install: not copy fields for theme record templates
Themes define records which are used as templates for the creation of base model records on theme installation on a website. E.g. a "theme.ir.attachment" record's purpose is to be a template for an "ir.attachment" record creation on theme installation on a website. Those final records have extra fields to indicate from which theme template they come from. If those records are ever to be duplicated, they should not duplicate those links to the theme templates otherwise it may cause issues when uninstalling/updating a theme (you want the records linked to the theme to be deleted/updated but not the duplicated ones, which do not act differently from user created ones). Duplicate ones will be linked to the website anyway (just like "normal" user created ones) and should only be automatically removed if that website is deleted. The issue is more visible from 14.0 where applying some modifications to images via the editor (crop / filter / optimization / ...) will duplicate the original image before modifying it. closes odoo/odoo#63951 X-original-commit: 890935bbdf924b06b7dabd89802f6dd824159a4b Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by: Samuel Degueldre <sad@odoo.com>
This commit is contained in:
co-authored by
Samuel Degueldre
parent
4532b67f3c
commit
4612343e99
@@ -253,7 +253,7 @@ class Theme(models.AbstractModel):
|
||||
class IrUiView(models.Model):
|
||||
_inherit = 'ir.ui.view'
|
||||
|
||||
theme_template_id = fields.Many2one('theme.ir.ui.view')
|
||||
theme_template_id = fields.Many2one('theme.ir.ui.view', copy=False)
|
||||
|
||||
def write(self, vals):
|
||||
no_arch_updated_views = other_views = self.env['ir.ui.view']
|
||||
@@ -273,17 +273,17 @@ class IrUiView(models.Model):
|
||||
class IrAttachment(models.Model):
|
||||
_inherit = 'ir.attachment'
|
||||
|
||||
key = fields.Char()
|
||||
theme_template_id = fields.Many2one('theme.ir.attachment')
|
||||
key = fields.Char(copy=False)
|
||||
theme_template_id = fields.Many2one('theme.ir.attachment', copy=False)
|
||||
|
||||
|
||||
class WebsiteMenu(models.Model):
|
||||
_inherit = 'website.menu'
|
||||
|
||||
theme_template_id = fields.Many2one('theme.website.menu')
|
||||
theme_template_id = fields.Many2one('theme.website.menu', copy=False)
|
||||
|
||||
|
||||
class WebsitePage(models.Model):
|
||||
_inherit = 'website.page'
|
||||
|
||||
theme_template_id = fields.Many2one('theme.website.page')
|
||||
theme_template_id = fields.Many2one('theme.website.page', copy=False)
|
||||
|
||||
Reference in New Issue
Block a user