[FIX] core: flush after every uninstall hook
Confusion between uninstall hooks can apparently trigger errors during uninstallation as two hooks can confuse one another? In this here case, the issue triggered during the uninstall hook of `account_accountant`, which apparently combines with the uninstall hook of `industry_fsm_sale` to trigger an invalid in-memory state for `project_project`. An implicit flush during the hook then blows up with a check constraint error. Flushing at the end of the `industry_fsm_sale` hook or at the start of the `account_accountant` hook fixes the issue, so might as well flush after each hook to ensure whatever they did using models is pushed to the database and in good shape (hopefully). X-original-commit: b28e9a7066d29d395421a11df2b9e170fb20d35a Part-of: odoo/odoo#121522
This commit is contained in:
@@ -553,6 +553,7 @@ def load_modules(registry, force_demo=False, status=None, update_module=False):
|
||||
if uninstall_hook:
|
||||
py_module = sys.modules['odoo.addons.%s' % (pkg.name,)]
|
||||
getattr(py_module, uninstall_hook)(env)
|
||||
env.flush_all()
|
||||
|
||||
Module = env['ir.module.module']
|
||||
Module.browse(modules_to_remove.values()).module_uninstall()
|
||||
|
||||
Reference in New Issue
Block a user