Search code examples
odoo-8odooodoo-10

Error with recursion


I'm getting RuntimeError: maximum recursion depth exceeded error and it's because of the line "'account_id','not in'" what can i do about it?

            @api.multi
            def to_invoice(self):
                    pos_order = self.env['pos.order'].search([('id','=',self._context.get('active_id'))])

                for line in pos_order.lines:
                domain3 = [
                    ('move_id', '=', pos_order.account_move.id),
                    ('credit', '=', pos_order.amount_tax),
                    ('account_id','not in', [pos_order.lines.tax_ids_after_fiscal_position, pos_order.lines.product_id.categ_id.property_account_income_categ_id])
            ]
                    if pos_order.amount_tax > 0:
                        move_line = 
self.env['account.move.line'].search(domain3)
                        print move_line
                    move_line[0].unlink()

Solution

  • This line should be

    ('account_id','not in', [line.tax_ids_after_fiscal_position.id, line.product_id.categ_id.property_account_income_categ_id.id])