This question has been flagged

Hello,

I've added an active field in account.analytic.account. At first it looks like it works like it should do, but when I try to search on Active = False with an advanced filter I get that error :

Server Traceback (most recent call last): File "/home/fabian/Code/openerp/7.0/server/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/home/fabian/Code/openerp/7.0/server/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/home/fabian/Code/openerp/7.0/server/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/home/fabian/Code/openerp/7.0/server/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/home/fabian/Code/openerp/7.0/server/openerp/osv/osv.py", line 131, in wrapper return f(self, dbname, args, *kwargs) File "/home/fabian/Code/openerp/7.0/server/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/home/fabian/Code/openerp/7.0/server/openerp/addons/audittrail/audittrail.py", line 514, in execute_cr return fct_src(cr, uid, model, method, args, *kw) File "/home/fabian/Code/openerp/7.0/server/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/home/fabian/Code/openerp/7.0/server/openerp/osv/orm.py", line 3623, in read result = self._read_flat(cr, user, select, fields, context, load) File "/home/fabian/Code/openerp/7.0/server/openerp/osv/orm.py", line 3738, in _read_flat if isinstance(res2[record['id']], str): res2[record['id']] = eval(res2[record['id']]) #TOCHECK : why got string instend of dict in python2.6 KeyError: 3024

Anyone familiar with the KeyError 3024 ? ;-)

I post it here as it's due to a (very small) customization and thus I cannot submit it to the support.

Fabian

Avatar
Discard
Best Answer

Hello,

It's due to the of the function field _debit_credit_bal_qtty in account/analytic/analytic.py. It does not support the case with an active=False field (the search call removes inactive records). As there is no active field is standard, it explained why we did not consider this case.

Unfortunately, if you want to have an active field you need to

  • redefine the function fields credit, debit, quantity, balance to use your own computation method

  • copy-paste most of the method and just modify the search part to include also inactive records

Avatar
Discard

Martin, This customization helped me.

Best Answer

Fabian,

This is a valid error!

I will check and tell you the fix!

Thanks.

Avatar
Discard