summaryrefslogtreecommitdiff
path: root/addons/payment_transfer
diff options
context:
space:
mode:
authorAdrian Torres <adt@odoo.com>2020-02-13 16:31:17 +0000
committerRaphael Collet <rco@odoo.com>2020-03-30 13:42:04 +0000
commitf0481392c6501cae2c38359f526da1eefa451337 (patch)
treee17b0fedb9abeb7ee71380005c1e7f8ec4ca9891 /addons/payment_transfer
parent96223568c445bc1d378fa4d8833f90d3dad8ec7e (diff)
[IMP] core: introduce mechanism for selection_add cleanup
- Let A and B be two different modules. - A defines a required Selection field F of model M and B extends it through the `selection_add` argument. - Create records of model M and have some of them have any of the options introduced by module B selected for field F. - Uninstall module B. The result will be records of Model M with an option for field F that no longer exists, this makes the registry inconsistent and prone to crashing (it is sufficient to access the form view of such a record to trigger a crash). This commit introduces a mechanism similar to the `ondelete` argument found in Many2one fields, the argument name is the same but it's different both in behaviour and in implementation. The `ondelete` mechanism for Selection fields is enforced for **any** Selection field with required set to `True`, this means that the developer is required to set a cleanup behaviour for when their module is uninstalled. For possible cleanup options, see fields.Selection's docstring. As far as implementation goes, everything is implemented in Python unlike with Many2one fields where the behaviour is delegated to PostgreSQL. The `ondelete` setting will be processed during `ir.model.fields.selection.unlink()` to ensure that the registry is left in an appropriate state after module uninstall.
Diffstat (limited to 'addons/payment_transfer')
0 files changed, 0 insertions, 0 deletions