나는 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
어떻게 해결할 수 있습니까?
대신 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] 삭제
몇 마디 만하겠습니다