0

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
Karara Mohamed
  • 923
  • 1
  • 6
  • 19
Chaban33
  • 1,362
  • 11
  • 38
  • Have you overridden the write method of this mode? If yes, cool you update your post with the code of the write ? – jo541 Oct 19 '17 at 15:31
  • What are you trying to do overall? It seems like overriding write may not be the best option. – travisw Oct 20 '17 at 01:40
  • the goal is. if i have quotation then i need to make shoes order from that quotation – Chaban33 Oct 20 '17 at 05:58
  • Have you tried to override the write (and/or create) method of quotations model and upon creating/writing quotation reorder shoes? Perhaps that way you might be able to avoid recursion.. – Ivica Nov 07 '17 at 12:13

0 Answers0