It starts an interactive Python console. If a database is provided, with the
`-d` argument `env` is bound to an Environement with the uid and context of
SUPERUSER_ID and `self` is bound to a RecordSet of the corresponding res.users.
Courtesy of Daniel Reis, reworked to be a bit more agnostic.
Command class is moved from __init__.py to command.py to improve imports of
__init__.py
The problem with the current approach is that it imports all modules in
order to discover which one exposes a subcommand by subclassing
openerp.cli.Command. At that time, the arguments are not parsed in order
to setup the config because a subcommand could potentialy alter the
command line arguments (which is the case of `start`)
This behavior causes the modules to be imported with the default config and all
the modules using some config keys at startup won't have to value they
are supposed to have when considering the shared command line switches.
Long story short:
$ odoo --workers=6
is ok, but
$ odoo start --workers=6
is not.
As the automatic subcommands are not used yet, we temporary disable it
until as proper solution is found.