OpenErp 8-Python
필드가 있습니다. 변경 사용시 compute_date
저장 버튼을 클릭합니다. state_for_date 변경 :
경우 compute_date
> 다음 state_for_date = 20 완
만약 compute_date
<20 다음 state_for_date = 새로운
state_for_date
이다 statusbar
compute_date = fields.Integer('Int')
state_for_date = fields.Selection([('new', 'New'),
('comp', 'Comp')],
'State', default='new', required=True)
def write(self, vals):
if self.compute_date < 20:
vals = {'state': 'new'}
if self.compute_date > 20:
vals = {'state': 'comp'}
return self.write(vals)
작동하지 않는 , 도움말 날의 오류 : RuntimeError에 : 최대 재귀 깊이를 초과
슈퍼 메서드를 호출하는 대신 재귀 쓰기 메서드를 호출하고 있습니다. 슈퍼 메서드를 호출해야합니다.
def write(self, vals):
if self.compute_date < 20:
vals = {'state': 'new'}
if self.compute_date > 20:
vals = {'state': 'comp'}
return super(class_name, self).write(vals)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다