summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-01-28 14:13:48 +0000
committerAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-01-29 08:15:34 +0000
commit35b84646ffc566b40c402092ee25630e07900372 (patch)
tree2732090d26c727d316e2ec83c4927d2f846e7017
parent5f6571a6fec60fee9688eeda2c97c9bb15cc2e3b (diff)
[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) <nim@odoo.com>
-rw-r--r--addons/web/controllers/main.py1
1 files changed, 1 insertions, 0 deletions
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))