summaryrefslogtreecommitdiff
path: root/openerp/models.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-06-28 13:11:35 +0200
committerChristophe Simonis <chs@odoo.com>2016-06-28 13:11:35 +0200
commit10550aa5a5ae261c3b1e1b9e4c95b4e5bfbe8ec6 (patch)
tree2f6f90e4df4d9703e1203754f903d545a23f76b3 /openerp/models.py
parentcbbc90fc2ef2a1a7e104c466fffb33766cf20986 (diff)
parente68ed417b6945c0dcb833533e25f2bbd2f01d045 (diff)
[MERGE] forward port of branch saas-6 up to e68ed41
Diffstat (limited to 'openerp/models.py')
-rw-r--r--openerp/models.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/openerp/models.py b/openerp/models.py
index de9158b5da8..648ff81dacd 100644
--- a/openerp/models.py
+++ b/openerp/models.py
@@ -3836,12 +3836,18 @@ class BaseModel(object):
if old_vals:
self._write(old_vals)
- # put the values of pure new-style fields into cache, and inverse them
if new_vals:
+ # put the values of pure new-style fields into cache
for record in self:
record._cache.update(record._convert_to_cache(new_vals, update=True))
+ # mark the fields as being computed, to avoid their invalidation
+ for key in new_vals:
+ self.env.computed[self._fields[key]].update(self._ids)
+ # inverse the fields
for key in new_vals:
self._fields[key].determine_inverse(self)
+ for key in new_vals:
+ self.env.computed[self._fields[key]].difference_update(self._ids)
return True
@@ -4150,10 +4156,16 @@ class BaseModel(object):
# create record with old-style fields
record = self.browse(self._create(old_vals))
- # put the values of pure new-style fields into cache, and inverse them
+ # put the values of pure new-style fields into cache
record._cache.update(record._convert_to_cache(new_vals))
+ # mark the fields as being computed, to avoid their invalidation
+ for key in new_vals:
+ self.env.computed[self._fields[key]].add(record.id)
+ # inverse the fields
for key in new_vals:
self._fields[key].determine_inverse(record)
+ for key in new_vals:
+ self.env.computed[self._fields[key]].discard(record.id)
return record