Skip to content
Snippets Groups Projects
Commit b381b0eb authored by Nils Hamerlinck's avatar Nils Hamerlinck Committed by Martin Trigaux
Browse files

[IMP] db: install unaccent extension on new databases


The unaccent extension was installed only at restore, not at creation
of a database.
Make both consistent.

closes odoo/odoo#46534

Signed-off-by: default avatarMartin Trigaux (mat) <mat@odoo.com>
parent 38781f16
No related branches found
No related tags found
No related merge requests found
......@@ -111,6 +111,15 @@ def _create_empty_database(name):
(name, collate, chosen_template)
)
if odoo.tools.config['unaccent']:
try:
db = odoo.sql_db.db_connect(name)
with closing(db.cursor()) as cr:
cr.execute("CREATE EXTENSION unaccent")
cr.commit()
except psycopg2.Error:
pass
@check_db_management_enabled
def exp_create_database(db_name, demo, lang, user_password='admin', login='admin', country_code=None, phone=None):
""" Similar to exp_create but blocking."""
......@@ -302,13 +311,6 @@ def restore_db(db, dump_file, copy=False):
filestore_dest = env['ir.attachment']._filestore()
shutil.move(filestore_path, filestore_dest)
if odoo.tools.config['unaccent']:
try:
with cr.savepoint(flush=False):
cr.execute("CREATE EXTENSION unaccent")
except psycopg2.Error:
pass
_logger.info('RESTORE DB: %s', db)
@check_db_management_enabled
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment