diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 7ae94f383b1589ec7248328cd80922337eca8d7a..81f09039f7badd5e04891e3dedcc52ab6727f801 100755
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -1094,15 +1094,18 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
         workflow = wflist[1]
       else:
         portal_type = wflist[0]
-        workflow = ''      
-      if workflow not in chain_dict['chain_%s' % portal_type]:
-        raise 
-      if self._objects.has_key(portal_type):
-        workflow_list = self._objects[portal_type]
-        workflow_list.append(workflow)
-        self._objects[portal_type] = workflow_list
+        workflow = ''
+      if chain_dict.has_key('chain_%s' % portal_type):
+        if workflow not in chain_dict['chain_%s' % portal_type]:
+          raise
+        if self._objects.has_key(portal_type):
+          workflow_list = self._objects[portal_type]
+          workflow_list.append(workflow)
+          self._objects[portal_type] = workflow_list
+        else:
+          self._objects[portal_type] = [workflow]
       else:
-        self._objects[portal_type] = [workflow]
+        LOG('BusinessTemplate build', 0, 'portal type %s not found in workflow chain' %(portal_type))
 
   def generateXml(self, path=None):
     xml_data = '<workflow_chain>'
@@ -4262,7 +4265,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
           base_category_list = portal_type.base_category_list       
         if hasattr(portal_type, 'listActions'):
           action_list = [x.getId() for x in portal_type.listActions()]
-        if chain_dict.has_key('chain_%s' % id):          
+        if chain_dict.has_key('chain_%s' % id):
           wf_list = chain_dict['chain_%s' % id].split(', ')
         
         for a_id in allowed_content_type_list: