summaryrefslogtreecommitdiff
path: root/odoo/api.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2019-08-23 09:08:42 +0000
committerRaphael Collet <rco@odoo.com>2019-08-23 10:00:12 +0000
commite388efd05941d50874c9f7ac1ca1226a4497e9f2 (patch)
treec0dddcdf9d40ee8b7b49ef2d6f78678c99766b4f /odoo/api.py
parentec3c76dc77b5239cb61f2f3dc64f2fd9bce28d48 (diff)
[FIX] api: share `protected` among environments
If a field is protected against recomputation, it must be protected in *all* environments.
Diffstat (limited to 'odoo/api.py')
-rw-r--r--odoo/api.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/api.py b/odoo/api.py
index d0d33886454..41439486d35 100644
--- a/odoo/api.py
+++ b/odoo/api.py
@@ -452,7 +452,7 @@ class Environment(Mapping):
self.cr, self.uid, self.context, self.su = self.args = args
self.registry = Registry(cr.dbname)
self.cache = envs.cache
- self._protected = StackMap() # {field: ids, ...}
+ self._protected = envs.protected # proxy to shared data structure
self.all = envs
envs.add(self)
return self
@@ -668,6 +668,7 @@ class Environments(object):
def __init__(self):
self.envs = WeakSet() # weak set of environments
self.cache = Cache() # cache for all records
+ self.protected = StackMap() # fields to protect {field: ids, ...}
self.tocompute = defaultdict(set) # recomputations {field: ids}
# updates {model: {id: {field: value}}}
self.towrite = defaultdict(lambda: defaultdict(dict))