[FIX] base: avoid triggering recomputation when deleted selection

In 6b048a8b8 most issue with trigger causing error when uninstalling a
module were solved.

But there was a particular case if the current uninstallation of modules
there was an update of `ir.model.fields.selection` to be removed. The
unlink of `ir.model.fields.selection` would cause a `setup_models` call
that would add all removed triggers back and possibly down the line
cause an trigger recomputation error.

With this changeset, we do as is already done for ir.model.fields and do
not re-initialize the registry during module uninstallation.

opw-2098915
closes #39796

closes odoo/odoo#39824

X-original-commit: 0ccf2ab8e7f3edabb2d3d4c17a20829de21cca49
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
This commit is contained in:
Adrian Torres
2019-11-05 18:43:26 +00:00
committed by fw-bot
parent 7ce07a7a1a
commit 7affe69117
+5 -2
View File
@@ -1179,8 +1179,11 @@ class IrModelSelection(models.Model):
result = super().unlink()
# setup models; this re-initializes model in registry
self.pool.setup_models(self._cr)
# Reload registry for normal unlink only. For module uninstall, the
# reload is done independently in odoo.modules.loading.
if not self._context.get(MODULE_UNINSTALL_FLAG):
# setup models; this re-initializes model in registry
self.pool.setup_models(self._cr)
return result