Files
odoo_source/addons/base_automation/models/ir_demo.py
T
Nicolas MartinelliandRaphael Collet c414873003 [FIX] base_automation: do not reload registry at create
The original issue is described in #29528, and the commit was reverted
in eb19016ba3.

The root cause of the issue was that the module `base.automation`
performs a `commit()` in `_update_registry`, which is called during a
`create`. This conflicts with the `savepoint` created in `load_demo`.

We postpone the registry reload after installing the demo data. Note
that we only do this in `base_automation`, to limit the potential side
effects.

opw-1920636

Co-authored-by: Raphael Collet <rco@odoo.com>

closes odoo/odoo#29863
2019-01-03 09:06:22 +00:00

23 lines
584 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class IrDemo(models.TransientModel):
_inherit = 'ir.demo'
def install_demo(self):
# Prevent the registry to reload while loading demo data, since `create` calls
# `_update_registry`.
self.pool.ready = False
try:
result = super().install_demo()
finally:
self.pool.ready = True
# Reload the registry
self.env['base.automation']._update_registry()
return result