OpenErp 8 - Python
我有场。使用更改compute_date
时,单击“保存”按钮。更改state_for_date:
如果compute_date
> 20然后state_for_date = comp
如果compute_date
< 20然后state_for_date = new
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:超出最大递归深度
答案 0 :(得分:1)
您正在调用递归写入方法而不是调用super方法。 你需要调用super方法。
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)