Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
26573 Vizualizări

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.

Imagine profil
Abandonează

if 'x_field' in x_obj:

....

Cel mai bun răspuns

You can check it like

if 'FIELD_NAME' in self.env['product.product']._fields:
...
...
Imagine profil
Abandonează