Commit af0ef5d
[IMP] util/records: enforce
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]>cascade removal for actions1 parent 3787631 commit af0ef5d
1 file changed
+48
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
313 | 357 | | |
314 | 358 | | |
315 | 359 | | |
| |||
352 | 396 | | |
353 | 397 | | |
354 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
355 | 403 | | |
356 | 404 | | |
357 | 405 | | |
| |||
0 commit comments