Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

RuntimeError: maximum recursion depth exceeded when invoice creation ?

By
vadivel
on 3/10/15, 7:18 AM 769 views

Hi friends,

When invoice creation the below error is occures:

File "/home/kavin/workspace/openerp_vvp_6.1/openerp/osv/orm.py", line 392, in __getitem__
    field_values = self._table.read(self._cr, self._uid, ids, field_names, context=self._context, load="_classic_write")
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/osv/orm.py", line 3424, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/osv/orm.py", line 3547, in _read_flat
    res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/osv/fields.py", line 551, in get
    ids2 = obj.pool.get(self._obj).search(cr, user, self._domain + [(self._fields_id, 'in', ids)], limit=self._limit, context=context)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/addons/account/account.py", line 1958, in search
    return super(account_tax, self).search(cr, uid, args, offset, limit, order, context, count)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/osv/orm.py", line 2253, in search
    return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/osv/orm.py", line 4588, in _search
    self.check_read(cr, access_rights_uid or user)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/osv/orm.py", line 3669, in check_read
    return self.check_access_rights(cr, uid, 'read', raise_exception)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/osv/orm.py", line 3663, in check_access_rights
    return self.pool.get('ir.model.access').check(cr, uid, self._name, operation, raise_exception)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/tools/cache.py", line 18, in lookup
    r = self.lookup(self2, cr, *args)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/tools/cache.py", line 41, in lookup
    r = d[key]
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/tools/func.py", line 35, in wrapper
    return func(self, *args, **kwargs)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/tools/lru.py", line 38, in __getitem__
    self[a[0]] = a[1]
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/tools/func.py", line 35, in wrapper
    return func(self, *args, **kwargs)
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/tools/lru.py", line 44, in __setitem__
    del self[obj]
  File "/home/kavin/workspace/openerp_vvp_6.1/openerp/tools/func.py", line 37, in wrapper
    lock.release()
RuntimeError: maximum recursion depth exceeded

and the code i have given belo for the reference:

Code:

            for order in invoice_obj.browse(cr, uid, ids, context=context):
                for line in order.invoice_line:
                    if not line.product_id.type == 'service':
                        for c in self.pool.get('account.tax').compute_all(cr, uid, line.invoice_line_tax_id, line.price_unit * (1-(line.discount or 0.00)/100.0), line.quantity, line.product_id, line.invoice_id.partner_id)['taxes']:
                            amount_tax_wo_service = cur_round(c['amount'] * (100.0 - (order.total_disc_percent or 0.0))/100.0)
                    if line.product_id.type == 'service':
                        for c in self.pool.get('account.tax').compute_all(cr, uid, line.invoice_line_tax_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.quantity, line.product_id, line.invoice_id.partner_id)['taxes']:
                            value += c.get('amount', 0.0)
                            amount_tax_service = cur_round(value)

            o_res['amount_tax'] = amount_tax_wo_service + amount_tax_service

Please do help me to sove this

 

 

1

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 3/10/15, 8:12 AM

Hi vadivel, try this code instead of your code:

for order in invoice_obj.browse(cr, uid, ids, context=context):
                for line in order.invoice_line:
                    if not line.product_id.type == 'service':
                        for c in self.pool.get('account.tax').compute_all(cr, uid, line.invoice_line_tax_id, line.price_unit * (1-(line.discount or 0.00)/100.0), line.quantity, line.product_id, line.invoice_id.partner_id)['taxes']:
                            amount_tax_wo_service = cur_round(c['amount'] * (100.0 - (order.total_disc_percent or 0.0))/100.0)
                    elif line.product_id.type == 'service':
                        for c in self.pool.get('account.tax').compute_all(cr, uid, line.invoice_line_tax_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.quantity, line.product_id, line.invoice_id.partner_id)['taxes']:
                            value += c.get('amount', 0.0)
                            amount_tax_service = cur_round(value)

           

         for record in self.browse(cr, uid, ids):

            o_res[record.id]['amount_tax'] = amount_tax_wo_service + amount_tax_service

         return o_res

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/10/15, 7:18 AM
Seen: 769 times
Last updated: 3/16/15, 8:10 AM