Reputation: 5
OpenErp 8 - Python
I have field. When use change compute_date
then click button Save. Change state_for_date :
if compute_date
> 20 then state_for_date = comp
if compute_date
< 20 then state_for_date = new
state_for_date
is 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)
Not working, help me Error : RuntimeError: maximum recursion depth exceeded
Upvotes: 0
Views: 535
Reputation: 14746
You are calling recursive write method instead of calling super method. You need to call super method.
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)
Upvotes: 1