diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 40c68b686718d2b67c8dbbb984dc030b69fe0cf9..70095a0fb338dbc4db856b10eb0971b13665404a 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -1896,6 +1896,8 @@ class PortalTypeTemplateItem(ObjectTemplateItem):
         else:
           portal_type = klass.__name__
         depend = path_dict.get(portal_type)
+        # Prevent infinite recursion
+        assert depend != path
         cache[path] = score = depend and 1 + solveDependency(depend)[0] or 0
       return score, path
     PersistentMigrationMixin._no_migration += 1