Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
26542 Weergaven

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
Annuleer

if 'x_field' in x_obj:

....

Beste antwoord

You can check it like

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