From 35b84646ffc566b40c402092ee25630e07900372 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Tue, 28 Jan 2020 14:13:48 +0000 Subject: [PATCH] [FIX] web: invalidate cursor after duplicate Login in into a database Access the database manager Duplicate a database Internal server error will occur and display user. This should not happen (even if the database is duplicated just fine), and occur because after the duplication the connection is dropped but the cursor will still hold the old reference and then, in the response generation it will crash. Invalidating cursor right after the duplication, like what is done after a 'drop' operation fix the issue opw-2170974 closes odoo/odoo#44159 X-original-commit: 59553c8595cdaf50a4c6f3ffe4093116d0f48bf1 Signed-off-by: Nicolas Martinelli (nim) --- addons/web/controllers/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 2876114ccaf..bf4e2aaa0fc 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1098,6 +1098,7 @@ class Database(http.Controller): if not re.match(DBNAME_PATTERN, new_name): raise Exception(_('Invalid database name. Only alphanumerical characters, underscore, hyphen and dot are allowed.')) dispatch_rpc('db', 'duplicate_database', [master_pwd, name, new_name]) + request._cr = None # duplicating a database leads to an unusable cursor return http.local_redirect('/web/database/manager') except Exception as e: error = "Database duplication error: %s" % (str(e) or repr(e))