From 80cf5fa4ff89e17befd59dfd87bff88bb7817e00 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Thu, 19 Feb 2009 15:10:19 +0530 Subject: [PATCH] [FIX] Bug 329357 : Copy method problem of Accounts. bzr revid: jvo@tinyerp.com-20090219094019-60blsbihme7s9lcx --- addons/account/account.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index cd0c8b59406..23635b298ac 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -371,19 +371,21 @@ class account_account(osv.osv): res.append((record['id'], name)) return res - def copy(self, cr, uid, id, default={}, context={}, done_list=[]): + def copy(self, cr, uid, id, default={}, context={}, done_list=[], local=False): account = self.browse(cr, uid, id, context=context) new_child_ids = [] if not default: default = {} default = default.copy() default['parent_id'] = False + if not local: + done_list = [] if account.id in done_list: return False done_list.append(account.id) if account: for child in account.child_id: - child_ids = self.copy(cr, uid, child.id, default, context=context, done_list=done_list) + child_ids = self.copy(cr, uid, child.id, default, context=context, done_list=done_list, local=True) if child_ids: new_child_ids.append(child_ids) default['child_parent_ids'] = [(6, 0, new_child_ids)]