odoo/upgrade-util#81

Created by Paulo Augusto de Lima Medeiros (palm)

Blocked

label
odoo-dev:master-add_actions_cascade_cleanup
head
7fc1c8552e7818547d2f207cc70fadd4c4689fac
odoo/upgrade-util
master #81 missing r+

[IMP] util/records: enforce `cascade` removal for actions

The implementation of the python inheritance mechanism between the base class ir.actions.actions and its child classes (eg. ir.actions.act_window) does not allow the creation of foreign keys when ir.actions.actions is a M2O field of another model; what leads to the not execution of some constraints, one of them being the ondelete='cascade' constraint, which is set in PSQL level.

That said, when a ir.actions.actions record is deleted, if it is being referenced as a M2O field by another model (eg. ir.filters), records from this second model won't be affected, what leads to undesired behaviour: a MissingError in the UI, indicating that the action was deleted.

Such behaviour of not creating foreign keys and thus constraints is specific to ir.actions.actions.
This commit remedies this specific case, removing records with a M2O field to ir.actions.actions with ondelete=cascade when the action referenced in such field is removed using upgrade-util.