I've got a weird problem when I call child refresh() method in parent model it works, but if I call it in the child model I get the runtime error.
# Working method in the parent model
@api.multi
def write(self, vals):
record = super(ParentModel, self).write(vals)
for child in self.child_ids:
child.refresh()
# method in child model that throws the error
@api.multi
def write(self, vals):
record = super(ChildModel, self).write(vals)
self.refresh()
The refresh method is calling all the computed methods of the child model and methods that just set data. And I need to call it in the child model when I'm setting data on the child model view and not on the parent model view.
So any ideas how to fix this or why it's happening?
Oh, I've found that this can happen if you have any depends methods, and I call them, but it fails on the every method! I tried commenting them out.
@api.multi
def refresh(self):
for rec in self:
rec._method1()
rec._computed_method1()