[FIX] core: env creation broken because of missing cr.transaction

A cursor created by a Connection object is not expected to be used with
environments; use registry.cursor() instead.

closes odoo/odoo#78143

X-original-commit: 6aeb73f10953f3547b7cf830718c02a3933df9e0
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit is contained in:
Albin
2021-10-11 11:27:46 +00:00
parent 2fbc5cce75
commit 0f56c0f0be
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -0,0 +1,11 @@
India, 2021-10-09

I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.

I declare that I am authorized and able to make this agreement and sign this
declaration.

Signed,

Albin John albin_john@tutamail.com https://github.com/Albin-John
+1 -1
View File
@@ -62,7 +62,7 @@ def _initialize_db(id, db_name, demo, lang, user_password, login='admin', countr
registry = odoo.modules.registry.Registry.new(db_name, demo, None, update_module=True)
with closing(db.cursor()) as cr:
with closing(registry.cursor()) as cr:
env = odoo.api.Environment(cr, SUPERUSER_ID, {})
if lang: