From 97a5c043b51c254018989dcc9701ba99b40cd739 Mon Sep 17 00:00:00 2001
From: Fabien Meghazi <fme@openerp.com>
Date: Tue, 10 Jun 2014 15:00:20 +0200
Subject: [PATCH] Always create missing db when using `odoo start`

---
 openerp/cli/start.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/openerp/cli/start.py b/openerp/cli/start.py
index b3bd47ede639..d23bca8b8d5e 100644
--- a/openerp/cli/start.py
+++ b/openerp/cli/start.py
@@ -48,15 +48,16 @@ class Start(Command):
 
         if not args.db_name:
             args.db_name = db_name or project_path.split(os.path.sep)[-1]
-            # TODO: forbid some database names ? eg template1, ...
-            try:
-                _create_empty_database(args.db_name)
-            except DatabaseExists, e:
-                pass
-            except Exception, e:
-                die("Could not create database `%s`. (%s)" % (args.db_name, e))
             cmdargs.extend(('-d', args.db_name))
 
+        # TODO: forbid some database names ? eg template1, ...
+        try:
+            _create_empty_database(args.db_name)
+        except DatabaseExists, e:
+            pass
+        except Exception, e:
+            die("Could not create database `%s`. (%s)" % (args.db_name, e))
+
         if '--db-filter' not in cmdargs:
             cmdargs.append('--db-filter=^%s$' % args.db_name)
 
-- 
GitLab