Skip to content

Commit 0f500c5

Browse files
author
Quentin (OpenERP)
committed
[FIX] analytic: chart of analytic accounts crashing in some use cases
lp bug: https://launchpad.net/bugs/933411 fixed bzr revid: [email protected]
1 parent e0d52f4 commit 0f500c5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

addons/analytic/analytic.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ def recursive_computation(account):
4747
recres[account.id] = recursive_computation(account)
4848
return recres
4949

50-
def _debit_credit_bal_qtty(self, cr, uid, ids, name, arg, context=None):
50+
def _debit_credit_bal_qtty(self, cr, uid, ids, fields, arg, context=None):
5151
res = {}
5252
if context is None:
5353
context = {}
5454
child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
5555
for i in child_ids:
5656
res[i] = {}
57-
for n in name:
57+
for n in fields:
5858
res[i][n] = 0.0
5959

6060
if not child_ids:
@@ -89,9 +89,11 @@ def _debit_credit_bal_qtty(self, cr, uid, ids, name, arg, context=None):
8989
WHERE a.id IN %s
9090
""" + where_date + """
9191
GROUP BY a.id""", where_clause_args)
92-
for ac_id, debit, credit, balance, quantity in cr.fetchall():
93-
res[ac_id] = {'debit': debit, 'credit': credit, 'balance': balance, 'quantity': quantity}
94-
return self._compute_level_tree(cr, uid, ids, child_ids, res, ['debit', 'credit', 'balance', 'quantity'], context)
92+
for row in cr.dictfetchall():
93+
res[row['id']] = {}
94+
for field in fields:
95+
res[row['id']][field] = row[field]
96+
return self._compute_level_tree(cr, uid, ids, child_ids, res, fields, context)
9597

9698
def name_get(self, cr, uid, ids, context=None):
9799
if not ids:

0 commit comments

Comments
 (0)