From 0846b6491e09f04b63f730f270a0f5d207f3b3b1 Mon Sep 17 00:00:00 2001 From: "jvo(OpenERP)" <> Date: Tue, 14 Dec 2010 10:34:44 +0530 Subject: [PATCH] [IMP] account: optimized code for __compute method lp bug: https://launchpad.net/bugs/568537 fixed bzr revid: psi@tinyerp.co.in-20101214050444-05jjxgm7xdf8tz17 --- addons/account/account.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 5726a5a793c..bedff44b7e8 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -289,20 +289,20 @@ class account_account(osv.osv): sums = {} while brs: current = brs[0] - can_compute = True - for child in current.child_id: - if child.id not in sums: - can_compute = False - try: - brs.insert(0, brs.pop(brs.index(child))) - except ValueError: - brs.insert(0, child) - if can_compute: - brs.pop(0) - for fn in field_names: - sums.setdefault(current.id, {})[fn] = accounts.get(current.id, {}).get(fn, 0.0) - if current.child_id: - sums[current.id][fn] += sum(sums[child.id][fn] for child in current.child_id) +# can_compute = True +# for child in current.child_id: +# if child.id not in sums: +# can_compute = False +# try: +# brs.insert(0, brs.pop(brs.index(child))) +# except ValueError: +# brs.insert(0, child) +# if can_compute: + brs.pop(0) + for fn in field_names: + sums.setdefault(current.id, {})[fn] = accounts.get(current.id, {}).get(fn, 0.0) + if current.child_id: + sums[current.id][fn] += sum(sums[child.id][fn] for child in current.child_id) res = {} null_result = dict((fn, 0.0) for fn in field_names) for id in ids: