summaryrefslogtreecommitdiff
path: root/odoo/api.py
diff options
context:
space:
mode:
authorRémy Voet (ryv) <ryv@odoo.com>2023-12-26 14:47:30 +0100
committerRémy Voet (ryv) <ryv@odoo.com>2024-01-15 13:04:10 +0000
commitbecb45d01491b68bb85bcdcd139721edb83b0c8b (patch)
tree8dab3a442075db7729907b3b9df852a41b6455df /odoo/api.py
parent8a34849b5c2a06eebf40be04e4b3f5dfa1cb247c (diff)
[REF] core: simplify BaseModel._flush()
_flush() has been simplified because some parts became unnecessary with the new flush mechanism, which is much more accurate. Part-of: odoo/odoo#144747
Diffstat (limited to 'odoo/api.py')
-rw-r--r--odoo/api.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/odoo/api.py b/odoo/api.py
index 1828de5ce35..09beb8b22b4 100644
--- a/odoo/api.py
+++ b/odoo/api.py
@@ -1020,8 +1020,7 @@ class Cache(object):
if record.pool.field_depends_context[field]:
# put the values under conventional context key values {'context_key': None},
# in order to ease the retrieval of those values to flush them
- context_none = dict.fromkeys(record.pool.field_depends_context[field])
- record = record.with_env(record.env(context=context_none))
+ record = record.with_env(record.env(context={}))
field_cache = self._set_field_cache(record, field)
field_cache[record._ids[0]] = value
elif record.id in self._dirty.get(field, ()):
@@ -1068,8 +1067,7 @@ class Cache(object):
if records.pool.field_depends_context[field]:
# put the values under conventional context key values {'context_key': None},
# in order to ease the retrieval of those values to flush them
- context_none = dict.fromkeys(records.pool.field_depends_context[field])
- records = records.with_env(records.env(context=context_none))
+ records = records.with_env(records.env(context={}))
field_cache = self._set_field_cache(records, field)
field_cache.update(zip(records._ids, values))
else: