summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/thread/thread.js
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2020-10-26 15:35:40 +0000
committerRaphael Collet <rco@odoo.com>2020-10-27 12:42:39 +0000
commit67152bf82da2674179297d32e4cec9dd534fa0c9 (patch)
treea13d31ebb9083e9245636d3c0e431b8ae93db07e /addons/mail/static/src/models/thread/thread.js
parent7342cadcfe8d85edb8a53aef0ecc402dbbc7e935 (diff)
[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: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'addons/mail/static/src/models/thread/thread.js')
0 files changed, 0 insertions, 0 deletions