summaryrefslogtreecommitdiff
path: root/odoo/cli
diff options
context:
space:
mode:
authorDaniel Reis <dgreis@sapo.pt>2017-04-19 09:11:18 +0100
committerFabien Meghazi <fme@odoo.com>2017-04-21 10:32:09 +0200
commit3e0b720e510cfad29748a36f66dcef204e8256f0 (patch)
tree41f267b9d55cc27b63f44d4ffdc97b650211c2b0 /odoo/cli
parent852940f1ba1219b106590efc580ec2b5fdfa1740 (diff)
[IMP] cli: extract the project's path from active virtualenv (closes: #16512)
The start command takes the default dbname from the path. But when running inside a virtualenv, it is a better default to take the dbname from the virtualenv's path.
Diffstat (limited to 'odoo/cli')
-rw-r--r--odoo/cli/start.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/odoo/cli/start.py b/odoo/cli/start.py
index 043c411ad8d..bf15776295b 100644
--- a/odoo/cli/start.py
+++ b/odoo/cli/start.py
@@ -35,6 +35,9 @@ class Start(Command):
args, unknown = parser.parse_known_args(args=cmdargs)
+ # When in a virtualenv, by default use it's path rather than the cwd
+ if args.path == '.' and os.environ.get('VIRTUAL_ENV'):
+ args.path = os.environ.get('VIRTUAL_ENV')
project_path = os.path.abspath(os.path.expanduser(os.path.expandvars(args.path)))
module_root = get_module_root(project_path)
db_name = None