[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: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
committed by
Martin Trigaux
parent
38781f1649
commit
b381b0eb6f
+9
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user