From e20cf77ce0546ac37dbfabd8c71a0ab33cedc3d7 Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Thu, 16 Apr 2015 09:45:39 +0100 Subject: [PATCH] [FIX] cli: Backport client command discovery optimization Lazy load modules to avoid import of unmet dependencies such as ldap. --- openerp/cli/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/openerp/cli/__init__.py b/openerp/cli/__init__.py index 31582d95292..c061175ac3e 100644 --- a/openerp/cli/__init__.py +++ b/openerp/cli/__init__.py @@ -56,12 +56,9 @@ def main(): if len(args) and not args[0].startswith("-"): logging.disable(logging.CRITICAL) for m in module.get_modules(): - m = 'openerp.addons.' + m - __import__(m) - #try: - #except Exception, e: - # raise - # print e + m_path = module.get_module_path(m) + if os.path.isdir(os.path.join(m_path, 'cli')): + __import__('openerp.addons.' + m) logging.disable(logging.NOTSET) command = args[0] args = args[1:]