diff options
| author | Raphael Collet <rco@odoo.com> | 2017-05-03 11:43:05 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2017-05-03 15:41:05 +0200 |
| commit | b59318ec12a1ce4e59de6d7bcde7146545b6c044 (patch) | |
| tree | f1c23d20305c2dfae87e3f2ad27e6fa525c00f27 /odoo/http.py | |
| parent | 1458f1b3135d373dac0625c7d4bd4a7eea3eaf54 (diff) | |
[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.
Diffstat (limited to 'odoo/http.py')
| -rw-r--r-- | odoo/http.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/odoo/http.py b/odoo/http.py index 210361fce1b..0b3ad105e39 100644 --- a/odoo/http.py +++ b/odoo/http.py @@ -278,6 +278,9 @@ class WebRequest(object): if self._cr: if exc_type is None and not self._failed: self._cr.commit() + self.registry.signal_changes() + else: + self.registry.reset_changes() self._cr.close() # just to be sure no one tries to re-use the request self.disable_db = True @@ -1467,7 +1470,6 @@ class Root(object): result = _dispatch_nodb() else: result = ir_http._dispatch() - ir_http.pool.signal_caches_change() else: result = _dispatch_nodb() |
