From cb58a2dbff0a984a63bc1d06803a7a0556b9cd08 Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Mon, 29 Aug 2011 11:04:22 +0530 Subject: [PATCH] [FIX] account : crash when desactivating an account lp bug: https://launchpad.net/bugs/833377 fixed bzr revid: bde@tinyerp.com-20110829053422-dd4ptp18i2r3poyn --- addons/account/account.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 7bf9cbd187b..a5fa3b5c945 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -250,6 +250,7 @@ class account_account(osv.osv): #compute for each account the balance/debit/credit from the move lines accounts = {} res = {} + null_result = dict((fn, 0.0) for fn in field_names) if children_and_consolidated: aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context) @@ -306,12 +307,11 @@ class account_account(osv.osv): sums[current.id][fn] += sums[child.id][fn] else: sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context) - null_result = dict((fn, 0.0) for fn in field_names) for id in ids: res[id] = sums.get(id, null_result) else: for id in ids: - res[id] = 0.0 + res[id] = null_result return res def _get_company_currency(self, cr, uid, ids, field_name, arg, context=None): @@ -1331,7 +1331,7 @@ class account_move(osv.osv): def _centralise(self, cr, uid, move, mode, context=None): assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection - currency_obj = self.pool.get('res.currency') + currency_obj = self.pool.get('res.currency') if context is None: context = {} @@ -1593,7 +1593,7 @@ class account_tax_code(osv.osv): (parent_ids,) + where_params) res=dict(cr.fetchall()) obj_precision = self.pool.get('decimal.precision') - res2 = {} + res2 = {} for record in self.browse(cr, uid, ids, context=context): def _rec_get(record): amount = res.get(record.id, 0.0)