From 4612343e9934b96644ebdc331dd49f314fbb8c27 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 31 Dec 2020 10:32:13 +0000 Subject: [PATCH] [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) Co-authored-by: Samuel Degueldre --- addons/website/models/theme_models.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/website/models/theme_models.py b/addons/website/models/theme_models.py index 62e6f05a769..848d3c5725b 100644 --- a/addons/website/models/theme_models.py +++ b/addons/website/models/theme_models.py @@ -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)