From 1388b7f0d8a2a66a5e96fc53bebc536e20a15f04 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 14 Jan 2019 13:02:06 +0000 Subject: [PATCH] [FIX] base: remove copied views before uninstall In dff64b6f7ca some copied views with no link to a module would be removed after module uninstall. But this has some side effects when the website module is being removed. For example: - website_theme_install, website are installed - website is uninstalled (which will uninstall website_theme_install) - website.theme_customize view can't be removed because it is used by copied view website_theme_install.customize_modal - after uninstall _remove_copied_views will remove the view website.theme_customize but when trying to remove associated website.page will throw an error because website_page table does not exist This issue does not happen if we uninstall first website_theme_install then website (since like this the reference is not an issue). The issue also happen with overriding views in theme_bootstrap and possibly elsewhere. With this changeset, copied views are removed before uninstalling module data. opw-1924714 closes #30191 --- odoo/addons/base/models/ir_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_module.py b/odoo/addons/base/models/ir_module.py index c939fe483e9..82b8b4e3cee 100644 --- a/odoo/addons/base/models/ir_module.py +++ b/odoo/addons/base/models/ir_module.py @@ -457,8 +457,8 @@ class Module(models.Model): tables, columns, constraints, etc. """ modules_to_remove = self.mapped('name') - self.env['ir.model.data']._module_data_uninstall(modules_to_remove) self._remove_copied_views() + self.env['ir.model.data']._module_data_uninstall(modules_to_remove) # we deactivate prefetching to not try to read a column that has been deleted self.with_context(prefetch_fields=False).write({'state': 'uninstalled', 'latest_version': False}) return True