diff options
| author | Sébastien Theys <seb@odoo.com> | 2018-12-28 13:17:26 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2019-01-09 12:54:47 +0000 |
| commit | c4ee25fb7ff6a6213e5d443756a0e7bc81e870e3 (patch) | |
| tree | 3a0f39807d1f913b392023706393828d25cf0dd8 /odoo/addons/base | |
| parent | 2e32cc5aa35044e8f0e7c299c8612a8095d9f479 (diff) | |
[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
Diffstat (limited to 'odoo/addons/base')
| -rw-r--r-- | odoo/addons/base/models/ir_module.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/addons/base/models/ir_module.py b/odoo/addons/base/models/ir_module.py index a270a46dfb1..2d24a06362f 100644 --- a/odoo/addons/base/models/ir_module.py +++ b/odoo/addons/base/models/ir_module.py @@ -24,6 +24,7 @@ import lxml.html import odoo from odoo import api, fields, models, modules, tools, _ +from odoo.addons.base.models.ir_model import MODULE_UNINSTALL_FLAG from odoo.exceptions import AccessDenied, UserError from odoo.osv import expression from odoo.tools.parse_version import parse_version @@ -472,7 +473,7 @@ class Module(models.Model): they rely on data that don't exist anymore if the module is removed. """ domain = expression.OR([[('key', '=like', m.name + '.%')] for m in self]) - orphans = self.env['ir.ui.view'].with_context(active_test=False).search(domain) + orphans = self.env['ir.ui.view'].with_context(**{'active_test': False, MODULE_UNINSTALL_FLAG: True}).search(domain) orphans.unlink() @api.multi |
