跳至内容
菜单
此问题已终结
2 回复
26537 查看

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:
...
...
形象
丢弃