summaryrefslogtreecommitdiff
path: root/odoo/tools/cache.py
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2019-06-24 12:08:17 +0000
committerXavier Morel <xmo@odoo.com>2019-06-24 12:29:41 +0000
commit5fd75da0e944952b2f8c9c4de19d84b3b78f6187 (patch)
tree1d4f51eb17eb2bee07c44739c4ea9aa74d1cd624 /odoo/tools/cache.py
parentab7ab7ebbb094c3fcce416a6ee26da6451280084 (diff)
[FIX] base: ir_rule don't not cache _compute_domain
Following the revamp / contextualisation of multi company, the list of allowed companies from the context is now used as part of the ir_rule caching key. Sadly that list is a list, and thus not hashable, meaning _compute_domain was not cached anymore. Sadlier, type errors would be silently ignored (just increasing the error counter of the cache stats). Fix both issues: * Store lists from the context as tuple. Technically could be a frozenset but that might not always be the case so it doesn't feel future-proof, a tuple might lead to slightly less hits but seems safer * Log a proper warning in case of an ormcache TypeError (non-hashable type used as cache key). It should never routinely happen. closes odoo/odoo#34330 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'odoo/tools/cache.py')
-rw-r--r--odoo/tools/cache.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/odoo/tools/cache.py b/odoo/tools/cache.py
index 8481df0d33d..806aac9bb70 100644
--- a/odoo/tools/cache.py
+++ b/odoo/tools/cache.py
@@ -91,6 +91,7 @@ class ormcache(object):
value = d[key] = self.method(*args, **kwargs)
return value
except TypeError:
+ _logger.warn("cache lookup error on %r", key, exc_info=True)
counter.err += 1
return self.method(*args, **kwargs)