[FIX] models: ormcache invalidation on import
Do not propagate cache invalidations to other workers when changes must be discarded, because of an import error or a dry run, which are both handled as successful transactions.
This commit is contained in:
@@ -885,6 +885,8 @@ class Import(models.TransientModel):
|
||||
try:
|
||||
if dryrun:
|
||||
self._cr.execute('ROLLBACK TO SAVEPOINT import')
|
||||
# cancel all changes done to the registry/ormcache
|
||||
self.pool.reset_changes()
|
||||
else:
|
||||
self._cr.execute('RELEASE SAVEPOINT import')
|
||||
except psycopg2.InternalError:
|
||||
|
||||
+2
-1
@@ -846,7 +846,6 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
|
||||
ids = []
|
||||
messages = []
|
||||
ModelData = self.env['ir.model.data']
|
||||
ModelData.clear_caches()
|
||||
|
||||
# list of (xid, vals, info) for records to be created in batch
|
||||
batch = []
|
||||
@@ -928,6 +927,8 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
|
||||
if any(message['type'] == 'error' for message in messages):
|
||||
cr.execute('ROLLBACK TO SAVEPOINT model_load')
|
||||
ids = False
|
||||
# cancel all changes done to the registry/ormcache
|
||||
self.pool.reset_changes()
|
||||
|
||||
return {'ids': ids, 'messages': messages}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user