summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2019-09-17 11:42:53 +0000
committerMartin Trigaux <mat@odoo.com>2019-09-20 12:25:06 +0000
commit948ce04649e46520a7f1d94d0249bbc776d27c2b (patch)
tree8825fed293aff28cb6c50aaab36fa957cc6a8f74 /doc/reference
parentfd3c3821861dcfecdd63079c799863002fd67d71 (diff)
[FIX] sql_db: retrieve correct environment
When creating a new database from the database manager, with no open cursor, the wrong env was retrieved during the cr.commit() call. 2019-09-09 18:16:07,454 19886 ERROR None odoo.service.db: CREATE DATABASE failed: Traceback (most recent call last): File "/home/odoo/odoo/service/db.py", line 60, in _initialize_db cr.commit() File "/home/odoo/odoo/sql_db.py", line 165, in wrapper return f(self, *args, **kwargs) File "/home/odoo/odoo/sql_db.py", line 389, in commit env = get_env(currentframe(), 2) File "/home/odoo/odoo/sql_db.py", line 72, in get_env env = getattr(frame.f_locals.get('self'), 'env', SENTINEL) File "/home/odoo/odoo/http.py", line 268, in env self._env = odoo.api.Environment(self.cr, self.uid, self.context) File "/home/odoo/odoo/http.py", line 238, in cr raise RuntimeError('request not bound to a database') get_env method checks every frame to find a variable called 'env' As none was found, it used the one of the WebRequest object. In a WebRequest, env is a property that will try to create a new Environment, which fails as no database is available (yet). At eafdf1812d3 the iteration on Environment.envs was removed as envs is a weakset and it introduced potential errors where the content was garbage-collected during the iteration. Go back to the simpler iteration but convert the set to list to avoid garbage-collection issues. Fixes odoo/odoo#36588 closes odoo/odoo#37005 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com> Co-authored-by: Raphael Collet <rco@odoo.com>
Diffstat (limited to 'doc/reference')
0 files changed, 0 insertions, 0 deletions