[FIX] core: fix create/write on binary fields
When invoking create() or write() with a binary field, the cache of the field was incorrect if bin_size=True was in context. Force context with bin_size=False when putting a binary value in cache. It is particularly important to have coherent values in the cache for `web_save`. Also, because an environment with bin_size=False won't return the same context cache key as one with bin_size=None, it leads to have a cache inconstistency when we write with bin_size=False. Change Environment method cache_key() to return the same cache key when bin_size is absent, bin_size=None or bin_size=False. Tests on binary fields have been updated to not rely on flush and invalidate. We also created specific tests for write() on binary fields. Part-of: odoo/odoo#160708
This commit is contained in:
committed by
Raphael Collet
parent
a0bf434960
commit
87a1ebb338
@@ -815,6 +815,8 @@ class Environment(Mapping):
|
||||
return get_context('lang') or None
|
||||
elif key == 'active_test':
|
||||
return get_context('active_test', field.context.get('active_test', True))
|
||||
elif key.startswith('bin_size'):
|
||||
return bool(get_context(key))
|
||||
else:
|
||||
val = get_context(key)
|
||||
if type(val) is list:
|
||||
|
||||
Reference in New Issue
Block a user