From 408175a727ecbca88957a9d63d8ec28f3e54c9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Ra=C3=AFch?= <miquel.raich@forgeflow.com> Date: Tue, 22 Aug 2023 15:55:07 +0000 Subject: [PATCH] [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#132751 Signed-off-by: Raphael Collet <rco@odoo.com> --- odoo/addons/base/models/ir_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_model.py b/odoo/addons/base/models/ir_model.py index cc7ccf9b498e..3ab21a2c76a7 100644 --- a/odoo/addons/base/models/ir_model.py +++ b/odoo/addons/base/models/ir_model.py @@ -1429,7 +1429,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) -- GitLab