Skip to content
Snippets Groups Projects
Commit 67152bf8 authored by Raphael Collet's avatar Raphael Collet
Browse files

[FIX] core: reinstall hooks after setting up models in registry


Before this patch, adding a field on a custom model discards all
automated actions on that model.  The explanation is relatively simple.
When models are set up in the registry, the classes of custom models are
dropped then recreated.  Given that automated actions are implemented as
monkey-patches on model classes, the setup of models simply loses those
monkey-patches, which explains why they stop working on custom models.

The fix introduces an `_unregister_hook()` method, that is expected to
clean up what has been done in `_register_hook()`.  When the registry is
ready (i.e., not being loaded), the setup of models first invokes
`_unregister_hook()` on models, proceeds with the setup, and finally
invokes `_register_hook()` to reinstall the hooks.

OPW 2362308

closes odoo/odoo#60818

X-original-commit: ac970380deaafb8542670951ed63dc11ffaf6b6c
Signed-off-by: default avatarRaphael Collet (rco) <rco@openerp.com>
parent 7342cadc
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment