diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index fbf14777675a6341bb4baaafca648a9a55e72d6e..e92950889296ede7c919cf5659673a83222334c4 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -2184,32 +2184,12 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
           self._filter_type_archive[method_id] = \
                       catalog.filter_dict[method_id]['type']
 
-  def export(self, context, bta, **kw):
+  def generateXml(self, path):
     catalog = _getCatalogValue(self)
-    if catalog is None:
-      LOG('BusinessTemplate, export', 0, 'no SQL catalog was available')
-      return
-
-    if len(self._objects.keys()) == 0:
-      return
-    root_path = os.path.join(bta.path, self.__class__.__name__)
-    for key in self._objects.keys():
-      obj = self._objects[key]
-      # create folder and subfolders
-      folders, id = posixpath.split(key)
-      path = os.path.join(root_path, folders)
-      bta.addFolder(name=path)
-      # export object in xml
-      f=StringIO()
-      XMLExportImport.exportXML(obj._p_jar, obj._p_oid, f)
-      bta.addObject(obj=f.getvalue(), name=id, path=path)
-      # add all datas specific to catalog inside one file
-      method_id = obj.id
-      object_path = os.path.join(path, method_id+'.catalog_keys.xml')
-
-      f = open(object_path, 'wb')
-      xml_data = '<catalog_method>'
-
+    obj = self._objects[path]
+    method_id = obj.id
+    xml_data = '<catalog_method>'
+    if self._method_properties.has_key(method_id):
       for method_property, value in self._method_properties[method_id].items():
         xml_data += '\n <item key="%s" type="int">' %(method_property,)
         xml_data += '\n  <value>%s</value>' %(value,)
@@ -2221,7 +2201,11 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
           xml_data += '\n  <value>1</value>'
           xml_data += '\n </item>'
           for method in catalog_method_filter_list:
-            value = getattr(self, method, '')[method_id]
+            try:
+              value = getattr(self, method, '')[method_id]
+            except KeyError:
+              # the method has no key
+              continue
             if method != '_filter_expression_instance_archive':
               if type(value) in (type(''), type(u'')):
                 xml_data += '\n <item key="%s" type="str">' %(method,)
@@ -2232,20 +2216,38 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
                 for item in value:
                   xml_data += '\n  <value>%s</value>' %(str(item))
                 xml_data += '\n </item>'
-      xml_data += '\n</catalog_method>'
-      f.write(xml_data)
-      f.close()
-
-  # Function to generate XML Code Manually
-  def generateXml(self, path=None):
-    obj = self._objects[path]
-    xml_data = '<key_list>'
-    obj.sort()
-    for key in obj:
-      xml_data += '\n <key>%s</key>' %(key)
-    xml_data += '\n</key_list>'
+    xml_data += '\n</catalog_method>'
     return xml_data
 
+  def preinstall(self, context, installed_bt, **kw):
+    modified_object_dict = ObjectTemplateItem.preinstall(self, context, installed_bt, **kw)
+    modified_object_dict.update(BaseTemplateItem.preinstall(self, context, installed_bt, **kw))
+    return modified_object_dict
+
+  def export(self, context, bta, **kw):
+    catalog = _getCatalogValue(self)
+    if catalog is None:
+      LOG('BusinessTemplate, export', 0, 'no SQL catalog was available')
+      return
+
+    if len(self._objects.keys()) == 0:
+      return
+    root_path = os.path.join(bta.path, self.__class__.__name__)
+    for key in self._objects.keys():
+      obj = self._objects[key]
+      # create folder and subfolders
+      folders, id = posixpath.split(key)
+      path = os.path.join(root_path, folders)
+      bta.addFolder(name=path)
+      # export object in xml
+      f=StringIO()
+      XMLExportImport.exportXML(obj._p_jar, obj._p_oid, f)
+      bta.addObject(obj=f.getvalue(), name=id, path=path)
+      # add all datas specific to catalog inside one file
+      key_name = os.path.join(obj.id+'.catalog_keys')
+      xml_data = self.generateXml(key)
+      bta.addObject(obj=xml_data, name=key_name, path=path)
+
   def install(self, context, trashbin, **kw):
     ObjectTemplateItem.install(self, context, trashbin, **kw)
     catalog = _getCatalogValue(self)