From b59318ec12a1ce4e59de6d7bcde7146545b6c044 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 3 May 2017 11:43:05 +0200 Subject: [REF] registry: always perform registry/cache signaling at the end of request Problem: the update of custom models/fields is not fully transactional, and may potentially lead to an inconsistent database. An other problem is creating two custom fields by writing on a model: if the second one fails, the first one has been committed without notice. Retrying the request will give an unexpected error (duplicate field name). Solution: never commit in the middle of a request. If the changes have an impact on the registry, then mark it as invalid (with a new flag), and signal registry invalidation after everything has been committed. If the request fails, reset the registry. Both registry and cache invalidation are handled the same way. --- odoo/modules/loading.py | 1 + 1 file changed, 1 insertion(+) (limited to 'odoo/modules/loading.py') diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index 7536c344528..f8c65d40177 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -133,6 +133,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules= if hasattr(package, 'init') or hasattr(package, 'update') or package.state in ('to install', 'to upgrade'): registry.setup_models(cr) registry.init_models(cr, model_names, {'module': package.name}) + cr.commit() idref = {} -- cgit v1.2.3