"read"메소드로 파이썬 객체를 호출하는 동안이 "RuntimeError"를 어떻게 해결합니까? : << 최대 재귀 깊이 초과 >>

Kajal Siyat

나는 Odoo에서 일하고 있습니다. read()메서드로 필드 값을 읽으려고합니다 .

이것은 내 코드입니다.

def name_get(self, cr, uid, ids, context=None):
    if isinstance(ids, (list, tuple)) and not len(ids):
        return []
    if isinstance(ids, (long, int)):
        ids = [ids]
    reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
    res = []
    for record in reads:
        name = record['name']
        if record['parent_id']:
            name = record['parent_id'][1]+' / '+name
        res.append((record['id'], name))
    return res

오류 발생 :

RuntimeError: maximum recursion depth exceeded

어떻게 해결할 수 있습니까?

ChesuCR

대신 read방법, 사용 browse또는 search방법을 사용하지 마십시오 . 이것이 당신을 위해 작동하는지 확인하십시오.

def name_get(self, cr, uid, ids, context=None):

    # [...]

    res=[]
    for record in self.browse(cr, uid, ids, context=context):
        name = record.name
        if record.parent_id:
            name = record.parent_id[0] + ' / ' + name
        res.append((record.id, name))
    return res

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관