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

I want to get the value of a field in a model, by passing the field name as string to a function, for that I defined a function inside the model like:

def get_value(self, key):
    key = key.replace('_', '.')
return self.__dict__.get('_prefetch').get(key)

my question is, is there a predefined function in odoo models that can do that, if not, how can I do that in a more pythonic way 

아바타
취소
작성자 베스트 답변

recordset['field_name'] or recordset.__getitem__() seems to be working fine, and they are more pythonic way to do what's needed

아바타
취소
관련 게시물 답글 화면 활동
2
10월 23
6471
2
11월 22
6869
0
9월 21
2972
4
8월 20
7778
2
3월 20
11662