mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 08:32:03 +02:00
18.0 vanilla
This commit is contained in:
parent
d72e748793
commit
0a7ae8db93
337 changed files with 399651 additions and 232598 deletions
|
|
@ -18,7 +18,7 @@ import re
|
|||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from psycopg2 import ProgrammingError, errorcodes
|
||||
from psycopg2.errors import InsufficientPrivilege
|
||||
|
||||
import odoo
|
||||
|
||||
|
|
@ -67,6 +67,10 @@ def report_configuration():
|
|||
port = config['db_port'] or os.environ.get('PGPORT', 'default')
|
||||
user = config['db_user'] or os.environ.get('PGUSER', 'default')
|
||||
_logger.info('database: %s@%s:%s', user, host, port)
|
||||
replica_host = config['db_replica_host']
|
||||
replica_port = config['db_replica_port']
|
||||
if replica_host is not False or replica_port:
|
||||
_logger.info('replica database: %s@%s:%s', user, replica_host or 'default', replica_port or 'default')
|
||||
if sys.version_info[:2] > odoo.MAX_PY_VERSION:
|
||||
_logger.warning("Python %s is not officially supported, please use Python %s instead",
|
||||
'.'.join(map(str, sys.version_info[:2])),
|
||||
|
|
@ -112,7 +116,7 @@ def export_translation():
|
|||
with open(config["translate_out"], "wb") as buf:
|
||||
registry = odoo.modules.registry.Registry.new(dbname)
|
||||
with registry.cursor() as cr:
|
||||
odoo.tools.trans_export(config["language"],
|
||||
odoo.tools.translate.trans_export(config["language"],
|
||||
config["translate_modules"] or ["all"], buf, fileformat, cr)
|
||||
|
||||
_logger.info('translation file written successfully')
|
||||
|
|
@ -130,7 +134,7 @@ def import_translation():
|
|||
|
||||
def main(args):
|
||||
check_root_user()
|
||||
odoo.tools.config.parse_config(args)
|
||||
odoo.tools.config.parse_config(args, setup_logging=True)
|
||||
check_postgres_user()
|
||||
report_configuration()
|
||||
|
||||
|
|
@ -148,15 +152,12 @@ def main(args):
|
|||
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
|
||||
# reporting unnecessary warnings on build environment
|
||||
# using restricted database access.
|
||||
_logger.info("Could not determine if database %s exists, "
|
||||
"skipping auto-creation: %s", db_name, err)
|
||||
else:
|
||||
raise err
|
||||
except InsufficientPrivilege as err:
|
||||
# We use an INFO loglevel on purpose in order to avoid
|
||||
# reporting unnecessary warnings on build environment
|
||||
# using restricted database access.
|
||||
_logger.info("Could not determine if database %s exists, "
|
||||
"skipping auto-creation: %s", db_name, err)
|
||||
except odoo.service.db.DatabaseExists:
|
||||
pass
|
||||
|
||||
|
|
@ -168,11 +169,6 @@ def main(args):
|
|||
import_translation()
|
||||
sys.exit(0)
|
||||
|
||||
# This needs to be done now to ensure the use of the multiprocessing
|
||||
# signaling mechanism for registries loaded with -d
|
||||
if config['workers']:
|
||||
odoo.multi_process = True
|
||||
|
||||
stop = config["stop_after_init"]
|
||||
|
||||
setup_pid_file()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue