account/project/project.py KeyError on currency[child]

Bug #610953 reported by Niels Huylebroeck
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

Steps to reproduce:
* Create 2 analytical accounts
* Link parent_id of one account to other
* Try to open parent account in form view.

Error received :
No LSB modules are available.
ERROR:common.message:Message 8:
Environment Information :
System : Linux-2.6.32-24-generic-x86_64-with-Ubuntu-10.04-lucid
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 10.04.1 LTS
Release: 10.04
Codename: lucid
Operating System Release : 2.6.32-24-generic
Operating System Version : #38-Ubuntu SMP Mon Jul 5 09:20:59 UTC 2010
Operating System Architecture : 64bit
Operating System Locale : en_US.UTF8
Python Version : 2.6.5
OpenERP-Client Version : 5.0.11
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/serveradmin/openerp-server/netsvc.py", line 247, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/serveradmin/openerp-server/netsvc.py", line 76, in __call__
    return getattr(self, method)(*params)
  File "/home/serveradmin/openerp-server/service/web_services.py", line 577, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/home/serveradmin/openerp-server/osv/osv.py", line 58, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/serveradmin/openerp-server/osv/osv.py", line 119, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/serveradmin/openerp-server/osv/osv.py", line 111, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/serveradmin/openerp-server/osv/orm.py", line 2228, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/home/serveradmin/openerp-server/osv/orm.py", line 2360, in _read_flat
    res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
  File "/home/serveradmin/openerp-server/osv/fields.py", line 659, in get
    res = self._fnct(obj, cr, user, ids, name, self._arg, context)
  File "/home/serveradmin/openerp-server/addons/account/project/project.py", line 133, in _balance_calc
    if currency[child]<>currency[id]:
KeyError: 8

The '8' signifies the id of the child analytical account.

The problem lies in this code :

=== modified file 'addons/account/project/project.py'
--- a/addons/account/project/project.py 2010-06-28 09:45:55 +0000
+++ b/addons/account/project/project.py 2010-07-28 15:36:29 +0000
@@ -117,7 +117,7 @@
         cr.execute("SELECT a.id, r.currency_id "
                    "FROM account_analytic_account a "
                    "INNER JOIN res_company r ON (a.company_id = r.id) "
- "WHERE a.id in %s", (tuple(ids),))
+ "WHERE a.id in %s", (tuple(ids2),))

         currency = dict(cr.fetchall())
         self.logger.notifyChannel('addons.'+self._name, netsvc.LOG_DEBUG,

ids2 contains the id's of the child accounts of the account currently being loaded.

When the list is viewed there is no problem because as it happens the child account is also in the ids (if it's on the same page)
but on the form view the currency_id of the child account is not retrieved thus triggering a KeyError exception.

Annotate shows revision 2620.1.16 as the faulty commit.

A fix is provided in revision 2752.

Just reporting this bug so you can track this for releaselog for 5.0.13.

Revision history for this message
Niels Huylebroeck (red15) wrote :

Please link to milestone 5.0.13 and mark Fix Commited (when release of 5.0.13 is there you can just look at launchpad for all the Fix Commited bugs with milestone 5.0.13 and you have your changelog)

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

It has already been fixed, but the commit did not link the fix as the commit was done prior to the bug reported.
Thanks for the care.

Changed in openobject-addons:
milestone: none → 5.0.13
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.