Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
26534 มุมมอง

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:
...
...
อวตาร
ละทิ้ง