You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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 when it is being referenced in favour of polymorphism;
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` if `ondelete=cascade`, or setting this field to NULL if
`ondelete=set null`, when the action referenced in such field is removed using
`upgrade-util`.
Co-authored-by: Christophe Simonis <[email protected]>
0 commit comments