Do not fail to clean fields from missing model from the pool

Closes #13504
This commit is contained in:
Cédric Krier committed 2024-09-12 13:17:37 +02:00
1 parent 8f4e926c81
commit effe2f74e2
1 file changed
+5 -2
+5 -2
View File
@@ -389,8 +389,11 @@ class ModelField(
cursor.execute(*ir_model_field.select(
ir_model_field.model, ir_model_field.name, ir_model_field.id))
for model, field, id_ in cursor:
Model = pool.get(model)
if field not in Model._fields:
try:
Model = pool.get(model)
except KeyError:
Model = None
if not Model or field not in Model._fields:
logger.info("remove field: %s.%s", model, field)
try:
cls.delete([cls(id_)])