From 9918e75b2c73c0823137ecc3db5495120b2bd78a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Fri, 28 Dec 2018 12:14:14 +0000 Subject: [FIX] website_theme_install: remove obsolete comment This comment is not true, we originally wanted to code it this way but we changed our mind and forgot to remove the comment. PR: #29753 --- addons/website_theme_install/models/ir_module_module.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'addons/website_theme_install/models/ir_module_module.py') diff --git a/addons/website_theme_install/models/ir_module_module.py b/addons/website_theme_install/models/ir_module_module.py index 00514b8fa3f..85a777efa7c 100644 --- a/addons/website_theme_install/models/ir_module_module.py +++ b/addons/website_theme_install/models/ir_module_module.py @@ -334,9 +334,6 @@ class IrModuleModule(models.Model): """ Remove any existing theme on the current website and install the theme ``self`` instead. - The removal of the previous theme will however keep the existing data - that will also be used in the new theme. - The actual loading of the theme on the current website will be done automatically on ``write`` thanks to the upgrade and/or install. -- cgit v1.2.3 From c4ee25fb7ff6a6213e5d443756a0e7bc81e870e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Fri, 28 Dec 2018 13:17:26 +0000 Subject: [FIX] base,*: add MODULE_UNINSTALL_FLAG to cleanup views * website_theme_install This commit will add MODULE_UNINSTALL_FLAG to the cleanup methods of themes and modules. This is necessary to also unlink inherited views of those we try to unlink. Before this commit, an error would be raised when trying to delete a view that still had other inherited views (either created manually by the user, or with just bad luck in the order of which the views are deleted). PR: #29753 --- addons/website_theme_install/models/ir_module_module.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'addons/website_theme_install/models/ir_module_module.py') diff --git a/addons/website_theme_install/models/ir_module_module.py b/addons/website_theme_install/models/ir_module_module.py index 85a777efa7c..55f77590c6b 100644 --- a/addons/website_theme_install/models/ir_module_module.py +++ b/addons/website_theme_install/models/ir_module_module.py @@ -6,6 +6,7 @@ import os from collections import OrderedDict from odoo import api, fields, models +from odoo.addons.base.models.ir_model import MODULE_UNINSTALL_FLAG from odoo.exceptions import MissingError from odoo.http import request @@ -206,7 +207,7 @@ class IrModuleModule(models.Model): for model_name in self._theme_model_names: template = self._get_module_data(model_name) - models = template.with_context(active_test=False).mapped('copy_ids').filtered(lambda m: m.website_id == website) + models = template.with_context(**{'active_test': False, MODULE_UNINSTALL_FLAG: True}).mapped('copy_ids').filtered(lambda m: m.website_id == website) models.unlink() self._theme_cleanup(model_name, website) @@ -235,8 +236,9 @@ class IrModuleModule(models.Model): if model_name in ('website.page', 'website.menu'): return model - - orphans = model.with_context(active_test=False).search([ + # use active_test to also unlink archived models + # and use MODULE_UNINSTALL_FLAG to also unlink inherited models + orphans = model.with_context(**{'active_test': False, MODULE_UNINSTALL_FLAG: True}).search([ ('key', '=like', self.name + '.%'), ('website_id', '=', website.id), ('theme_template_id', '=', False), -- cgit v1.2.3