summaryrefslogtreecommitdiff
path: root/odoo
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2019-11-15 14:47:33 +0000
committerfw-bot <otis@odoo.com>2019-11-15 18:46:13 +0000
commit83a0c46dbb6e66418b763453d6eb403161e3a79c (patch)
treef51a0eaa600743c485fd919a13ad29074d559b7f /odoo
parentd57e0cb1e7bc8d866fc847b67343e59fde08ccd9 (diff)
[FIX] registry: init_models() using a closed cursor
When a call to init_models() fails, the post-init queue still contains callables that refer to a soon-to-be-closed cursor. If one calls init_models() in another request, the post-init process will inevitably fail because it refers to closed cursors. closes odoo/odoo#40379 X-original-commit: 33f87ffebaa1cb38e3ce8ce44c8b8b538b49e5b9 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'odoo')
-rw-r--r--odoo/modules/registry.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/odoo/modules/registry.py b/odoo/modules/registry.py
index 19124738624..dc03d0b24d3 100644
--- a/odoo/modules/registry.py
+++ b/odoo/modules/registry.py
@@ -313,6 +313,9 @@ class Registry(Mapping):
env = odoo.api.Environment(cr, SUPERUSER_ID, context)
models = [env[model_name] for model_name in model_names]
+ # make sure the queue does not contain some leftover from a former call
+ self._post_init_queue.clear()
+
for model in models:
model._auto_init()
model.init()