Skip to content

Commit e682b89

Browse files
committed
[FIX] fields: use function to check manual name
The use of IrModelFields method is_manual_name was reverted for the sake of efficiency and avoiding instanciating models when not really needed. The use of an overridable method is still needed. closes #224524 Signed-off-by: Xavier Dollé (xdo) <[email protected]>
1 parent a5455bf commit e682b89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

odoo/orm/model_classes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def add_field(model_cls: type[BaseModel], name: str, field: Field):
589589
isinstance(getattr(model, name, None), fields.Field)
590590
for model in [model_cls] + [model_cls.pool[inherit] for inherit in model_cls._inherits]
591591
)
592-
if not (is_class_field or name.startswith('x_')):
592+
if not (is_class_field or model_cls.pool['ir.model.fields']._is_manual_name(None, name)):
593593
raise ValidationError( # pylint: disable=missing-gettext
594594
f"The field `{name}` is not defined in the `{model_cls._name}` Python class and does not start with 'x_'"
595595
)

0 commit comments

Comments
 (0)