[IMP] core: require install mode for db bootstrap
The registry loading system should not alter databases unless it is asked to do so, by a module installation or update instruction. This property should hold true as well for database bootstrap, and this is what this commit changes.. In order to avoid any behavior change for command-line users, an implicit `-i base` is assumed when starting the server from the command-line with `-d <db>`, causing the db boostrap to happen if the database did not exist yet.
This commit is contained in:
@@ -138,6 +138,7 @@ def main(args):
|
||||
for db_name in preload:
|
||||
try:
|
||||
odoo.service.db._create_empty_database(db_name)
|
||||
config['init']['base'] = True
|
||||
except ProgrammingError as err:
|
||||
if err.pgcode == errorcodes.INSUFFICIENT_PRIVILEGE:
|
||||
# We use an INFO loglevel on purpose in order to avoid
|
||||
|
||||
@@ -7,6 +7,7 @@ import itertools
|
||||
import os
|
||||
import sys
|
||||
|
||||
import odoo
|
||||
from . import Command
|
||||
from .server import main
|
||||
from odoo.modules.module import get_module_root, MANIFEST_NAMES
|
||||
@@ -60,6 +61,7 @@ class Start(Command):
|
||||
# TODO: forbid some database names ? eg template1, ...
|
||||
try:
|
||||
_create_empty_database(args.db_name)
|
||||
odoo.tools.config['init']['base'] = True
|
||||
except DatabaseExists as e:
|
||||
pass
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user