From ef278ffae6da5a72eabe6ea026a2cc8c3ae97561 Mon Sep 17 00:00:00 2001 From: mtr Date: Tue, 5 Jul 2011 17:56:39 +0530 Subject: [PATCH] [IMP] account: improved store dictionary of function field 'level' bzr revid: mtr@mtr-20110705122639-nq3yqkebakr4vig7 --- 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 b3b6016fc74..24b04ea6ae7 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -332,9 +332,9 @@ class account_account(osv.osv): for acc in record.child_consol_ids: if acc.id not in result[record.id]: result[record.id].append(acc.id) - + return result - + def _get_level(self, cr, uid, ids, field_name, arg, context=None): res = {} accounts = self.browse(cr, uid, ids, context=context) @@ -344,7 +344,7 @@ class account_account(osv.osv): while parent_id: obj = self.browse(cr, uid, parent_id.id) level += 1 - parent_id = obj.parent_id + parent_id = obj.parent_id res[account.id] = level return res @@ -394,7 +394,7 @@ class account_account(osv.osv): required=True), 'level': fields.function(_get_level, string='Level', method=True, type='integer', store={ - 'account.account': (lambda self, cr, uid, ids, c={}: ids, ['parent_id'], 10), + 'account.account': (_get_children_and_consol, [], 10), }), }