From df002518eebc06aa90e45bcfc5d5bc8c355fb2e0 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 31 Jul 2015 18:24:46 +0200 Subject: [PATCH] [FIX] models: access error due to prefetch of indirectly referenced records Complements commit af9393d5059a41bc3bf7042ffdfefa070b7506c5 in light of commit 62b0d99cfe537e7f7f1e8794974230abbcdbfe44, to really have the correct effect. When the prefetching failed due to the presence of extra records in the cache (for which the access is denied), the `read` operation was indeed retried. However the result was not stored in the cache because the cache already held a FailedValue (automatically added when the prefetch failed). --- openerp/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/models.py b/openerp/models.py index 6820496aaca..f6be7cc06db 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -3234,7 +3234,7 @@ class BaseModel(object): result = self.read(list(fnames), load='_classic_write') # check the cache, and update it if necessary - if not self._cache.contains(field): + if field not in self._cache: for values in result: record = self.browse(values.pop('id')) record._cache.update(record._convert_to_cache(values, validate=False))