Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
26533 Prikazi

I have a model res_partner_attributes. Before updating specific field say x_myNumber, how to check if the field exists? If the field does not exist then create the field and update its value.

Avatar
Opusti

if 'x_field' in x_obj:

....

Best Answer

You can check it like

if 'FIELD_NAME' in self.env['product.product']._fields:
...
...
Avatar
Opusti