UPDATE updated my question.
@api.multi
def write(self, vals):
result = super(PosQuotation, self).write(vals)
if 'state' in vals:
for rec in self:
if rec.state != "delivery_success":
continue
domain = [('quatation_id', '=', rec.id)]
shoes = self.env['shoes.order'].search(domain, limit=1)
shoes.handed_to_client()
self.update_shoes_order()
return result
@api.model
def update_shoes_order(self,):
datas = safe_eval(self.datas)
domain = [('quatation_id', '=', self.id)]
glasses = self.env['shoes.order'].search(domain, limit=1)
vals = {
'partner_id': self.partner_id.id,
'user_id': self.user_id.id,
'amount_total': datas['amount_total'],
}
for line in datas['lines']:
line = line and line[2]
vals = {
u'product_id': line.get('product_id'),
}
shoes.write(vals)
i'm getting this error when try to run my code. i know that this is an infinite loop but how can i avoid it. try to put dics to the list?
RuntimeError: maximum recursion depth exceeded