[FIX] base: deleting selection fields of non tabled models

When a model selection record is going to be deleted, a _process_ondelete method is called in order to delete all the records of the corresponding model that have that selection. These records are obtained by calling _get_records, which uses a query that needs a table. Thus, we should avoid cases for non-abstract models that have _auto = False.

closes odoo/odoo#133118

X-original-commit: 408175a727ecbca88957a9d63d8ec28f3e54c9df
Signed-off-by: Raphael Collet <rco@odoo.com>
This commit is contained in:
Miquel Raïch
2023-08-25 10:59:48 +02:00
parent 603a7d0b2f
commit fd53a6bac6
+1 -1
View File
@@ -1536,7 +1536,7 @@ class IrModelSelection(models.Model):
# the orphaned 'ir.model.fields' down the stack, and will log a
# warning prompting the developer to write a migration script.
field = Model._fields.get(selection.field_id.name)
if not field or not field.store or Model._abstract:
if not field or not field.store or not Model._auto:
continue
ondelete = (field.ondelete or {}).get(selection.value)