Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
26530 Представления

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.

Аватар
Отменить

if 'x_field' in x_obj:

....

Лучший ответ

You can check it like

if 'FIELD_NAME' in self.env['product.product']._fields:
...
...
Аватар
Отменить