콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
26645 화면

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:
...
...
아바타
취소