Skip to content
Snippets Groups Projects
Commit c87b9c65 authored by Olivier Dony's avatar Olivier Dony
Browse files

[FIX] decimal_precision: avoid refreshing float precisions at each cache invalidation

Changing the decimal precision of float fields is a rare
operation, while cache clearing occurs fairly frequently.
Signaling a full registry change when the decimal precision
is changed (instead of a mere cache change) is therefore
a better trade-off, and more semantically correct as well.
This way we avoid the decimal precision refresh for each
invalidation.

Registry invalidation implies cache invalidation.
parent 8ce89736
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ class decimal_precision(orm.Model):
for field in model._fields.values():
if field.type == 'float':
field._setup_digits(env)
RegistryManager.signal_caches_change(cr.dbname)
RegistryManager.signal_registry_change(cr.dbname)
def create(self, cr, uid, data, context=None):
res = super(decimal_precision, self).create(cr, uid, data, context=context)
......
......@@ -429,14 +429,6 @@ class RegistryManager(object):
_logger.info("Invalidating all model caches after database signaling.")
registry.clear_caches()
registry.reset_any_cache_cleared()
# One possible reason caches have been invalidated is the
# use of decimal_precision.write(), in which case we need
# to refresh fields.float columns.
env = openerp.api.Environment(cr, SUPERUSER_ID, {})
for model in registry.values():
for field in model._fields.values():
if field.type == 'float':
field._setup_digits(env)
registry.base_registry_signaling_sequence = r
registry.base_cache_signaling_sequence = c
finally:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment