From b58acb14e8c1926254e6fdf0b13ab79334ce6f48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Thu, 29 Dec 2005 17:17:46 +0000
Subject: [PATCH] reomve objects after installation of new one

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4948 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index cebabece5b..ea48aaf981 100755
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -3294,7 +3294,15 @@ Business Template is a set of definitions, such as skins, portal types and categ
       else:
         trashbin = None
               
+      # Install everything
+      if len(object_to_update) > 0 or force:
+        for item_name in self._item_name_list:
+          item = getattr(self, item_name, None)
+          if item is not None:
+            item.install(local_configuration, force=force, object_to_update=object_to_update, trashbin=trashbin)
+
       # get objects to remove
+      # do remove after because we may need backup object from installation
       remove_object_dict = {}
       for path in object_to_update.keys():
         action = object_to_update[path]
@@ -3307,12 +3315,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
           item = getattr(installed_bt, item_name, None)
           if item is not None:
             item.remove(local_configuration, remove_object_dict=remove_object_dict, trashbin=trashbin)
-      # Install everything
-      if len(object_to_update) > 0 or force:
-        for item_name in self._item_name_list:
-          item = getattr(self, item_name, None)
-          if item is not None:
-            item.install(local_configuration, force=force, object_to_update=object_to_update, trashbin=trashbin)
+
 
       # update tools if necessary
       if self.getTitle() == 'erp5_core' and self.getTemplateUpdateTool():
-- 
2.30.9