diff --git a/product/ERP5Type/Tool/TypesTool.py b/product/ERP5Type/Tool/TypesTool.py
index 21d588d5281decf174801735b307dc27dd985027..a87f8eecc8d14cc976a7328d92a09ad09d6fe020 100644
--- a/product/ERP5Type/Tool/TypesTool.py
+++ b/product/ERP5Type/Tool/TypesTool.py
@@ -180,7 +180,7 @@ class TypesTool(TypeProvider):
     """
     portal_type = None
     if isinstance(context, type):
-      if 'erp5' in context.__module__:
+      if context.__module__ in ('erp5.portal_type', 'erp5.temp_portal_type'):
         portal_type = context.__name__
       else:
         portal_type = getattr(context, 'portal_type', None)