diff options
| author | Samus CTO <cto@openerp.com> | 2014-12-23 16:28:42 +0100 |
|---|---|---|
| committer | Samus CTO <cto@openerp.com> | 2014-12-23 16:29:33 +0100 |
| commit | 4b387e73cb9cd051bd549e626b9255cf3bb5ea17 (patch) | |
| tree | 5b3b49601433d406c0dc85000818f42ea3c1f9aa /openerp/cli/command.py | |
| parent | 9c2c2a3cb0cdb45c704ddf1411654d89b060e918 (diff) | |
[IMP] shell: load Odoo modules that have a "cli" directory
Diffstat (limited to 'openerp/cli/command.py')
| -rw-r--r-- | openerp/cli/command.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/openerp/cli/command.py b/openerp/cli/command.py index de76e77d95f..d384cdd747b 100644 --- a/openerp/cli/command.py +++ b/openerp/cli/command.py @@ -1,8 +1,10 @@ import logging import sys import os +from os.path import join as joinpath, isdir import openerp +from openerp.modules import get_modules, get_module_path commands = {} @@ -49,11 +51,11 @@ def main(): # TODO: find a way to properly discover addons subcommands without importing the world # Subcommand discovery if len(args) and not args[0].startswith("-"): - # logging.disable(logging.CRITICAL) - # for m in module.get_modules(): - # m = 'openerp.addons.' + m - # __import__(m) - # logging.disable(logging.NOTSET) + logging.disable(logging.CRITICAL) + for module in get_modules(): + if isdir(joinpath(get_module_path(module), 'cli')): + __import__('openerp.addons.' + module) + logging.disable(logging.NOTSET) command = args[0] args = args[1:] |
