diff --git a/product/ERP5/ERP5Site.py b/product/ERP5/ERP5Site.py
index c68d46f55694c10d6c13c8fc20c2b3e6f5458d0b..c9b940bf94299e27ca12beed8251723dd7b2d0fa 100644
--- a/product/ERP5/ERP5Site.py
+++ b/product/ERP5/ERP5Site.py
@@ -938,7 +938,7 @@ class ERP5Site(FolderMixIn, CMFSite):
     if portal_object._getOb(expected_module_id, None) is not None:
       module_id = expected_module_id
     expected_module_id += '_module'
-    if module is None and portal_object._getOb(expected_module_id, None) \
+    if module_id is None and portal_object._getOb(expected_module_id, None) \
         is not None:
       module_id = expected_module_id
     # then look for module where the type is allowed