Martin TrigauxandRaphael Collet 948ce04649 [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 eafdf1812d 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>
2019-09-20 12:25:06 +00:00
…
2018-10-09 13:44:38 +00:00
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

Then follow the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%