Ujjvala Collins (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-708073-uco into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #708073 in OpenERP Addons: "[6.0.1] analytic account: view 
account.analytic.account.tree gives incorrect sum"
  https://bugs.launchpad.net/openobject-addons/+bug/708073

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-708073-uco/+merge/67331

[FIX] account:
-----------------------
* Fixed analytic account tree view showing wrong sum for debit, credit, balance 
and quantity fields. (lp:708073)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-708073-uco/+merge/67331
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-708073-uco.
=== modified file 'analytic/analytic.py'
--- analytic/analytic.py	2011-07-01 23:41:24 +0000
+++ analytic/analytic.py	2011-07-08 19:15:31 +0000
@@ -30,11 +30,14 @@
     _description = 'Analytic Account'
 
     def _compute_level_tree(self, cr, uid, ids, child_ids, res, field_names, context=None):
-        def recursive_computation(account_id, res):
+        def recursive_computation(account_id, res, repeated_account_ids=[]):
             currency_obj = self.pool.get('res.currency')
             account = self.browse(cr, uid, account_id)
             for son in account.child_ids:
+                if son.id in repeated_account_ids:
+                    continue
                 res = recursive_computation(son.id, res)
+                repeated_account_ids.append(son.id)
                 for field in field_names:
                     if account.currency_id.id == son.currency_id.id or field=='quantity':
                         res[account.id][field] += res[son.id][field]

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to