From 5acc43e3986b03c80c8a4eb61b156ec416653078 Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Fri, 29 Aug 2008 15:05:34 +0530 Subject: [PATCH] Corrected copy behaviour of children of root account. bzr revid: jvo@tinyerp.com-20080829093534-kbhk4rrg3dx1xcqw --- addons/account/account.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index a27732d5f57..f6b3328eea6 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -346,13 +346,18 @@ class account_account(osv.osv): res.append((record['id'],name )) return res - def copy(self, cr, uid, id, default={}, context={}): + def copy(self, cr, uid, id, default={}, context={},done_list=[]): account = self.browse(cr, uid, id, context=context) new_child_ids = [] default['parent_id'] = False + if account.id in done_list: + return False + done_list.append(account.id) if account: for child in account.child_id: - new_child_ids.append(self.copy(cr, uid, child.id, default, context=context)) + child_ids=self.copy(cr, uid, child.id, default, context=context,done_list=done_list) + if child_ids: + new_child_ids.append(child_ids) default['child_id'] = [(6, 0, new_child_ids)] else: default['child_id'] = False