Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
26552 Widoki

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.

Awatar
Odrzuć

if 'x_field' in x_obj:

....

Najlepsza odpowiedź

You can check it like

if 'FIELD_NAME' in self.env['product.product']._fields:
...
...
Awatar
Odrzuć