Do not store in transaction cache instances of Reference fields

If the target of the Reference field is deleted, the transaction cache is not
cleared because there is no "ON DELETE" support for Reference field. Instead
the ids are checked in the Reference.get method.

Closes #12599
This commit is contained in:
Cédric Krier
2023-09-28 17:44:29 +02:00
parent c6ac00261d
commit e65b98524e
+2 -1
View File
@@ -1811,7 +1811,8 @@ class ModelStorage(Model):
# create browse records for 'remote' models
no_local_cache = {'binary'}
if not transaction.readonly:
no_local_cache |= {'one2one', 'one2many', 'many2many'}
no_local_cache |= {
'one2one', 'one2many', 'many2many', 'reference'}
for data in read_data:
id_ = data['id']
to_delete = set()