Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
26538 Näkymät

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
Hylkää

if 'x_field' in x_obj:

....

Paras vastaus

You can check it like

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