[REV] Revert "[FIX] modules: load demo data fallback"

This reverts commit 5f4a945182.
The cure is worse than the original disease.

The main installation cursor often holds exclusive locks (due to DDL
changes) on vital tables such as res_users. As a result, using
another cursor to perform changes while the main cursor is waiting
is extremely deadlock-prone. And these deadlocks can't be detected by
PostgreSQL as they mix Python-SQL locking, which leads to deadlocked
HTTP workers.

Related to:
- opw-1916918
- #29528
This commit is contained in:
Olivier Dony
2018-12-21 16:01:31 +01:00
parent f4e7e06a1f
commit eb19016ba3
+7 -9
View File
@@ -89,15 +89,13 @@ def load_demo(cr, package, idref, mode, report=None):
"Module %s demo data failed to install, installed without demo data",
package.name, exc_info=True)
registry = odoo.registry(cr.dbname)
with registry.cursor() as cr:
env = api.Environment(cr, SUPERUSER_ID, {})
todo = env.ref('base.demo_failure_todo', raise_if_not_found=False)
Failure = env.get('ir.demo_failure')
if todo and Failure is not None:
todo.state = 'open'
Failure.create({'module_id': package.id, 'error': str(e)})
return False
env = api.Environment(cr, SUPERUSER_ID, {})
todo = env.ref('base.demo_failure_todo', raise_if_not_found=False)
Failure = env.get('ir.demo_failure')
if todo and Failure is not None:
todo.state = 'open'
Failure.create({'module_id': package.id, 'error': str(e)})
return False
def force_demo(cr):