[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.
This commit is contained in:
Raphael Collet
2017-05-03 15:41:05 +02:00
parent 1458f1b313
commit b59318ec12
15 changed files with 85 additions and 65 deletions
-1
View File
@@ -189,7 +189,6 @@ def drop_index(cr, indexname, tablename):
def drop_view_if_exists(cr, viewname):
cr.execute("DROP view IF EXISTS %s CASCADE" % (viewname,))
cr.commit()
def escape_psql(to_escape):
return to_escape.replace('\\', r'\\').replace('%', '\%').replace('_', '\_')