[IMP] models: in recompute, do not store fields that should not be recomputed
Consider a new field that uses the same compute method as another existing field. When the field is introduced in database, its value must be computed on existing records. In such a case, the existing field should not be written, as its value is not supposed to have changed. Not writing on the existing field can avoid useless recomputations in cascade, which is the reason we introduce this patch.
This commit is contained in:
parent
6b72008c32
commit
1a535b9d87
|
@ -5667,7 +5667,11 @@ class BaseModel(object):
|
|||
while self.env.has_todo():
|
||||
field, recs = self.env.get_todo()
|
||||
# evaluate the fields to recompute, and save them to database
|
||||
names = [f.name for f in field.computed_fields if f.store]
|
||||
names = [
|
||||
f.name
|
||||
for f in field.computed_fields
|
||||
if f.store and self.env.field_todo(f)
|
||||
]
|
||||
for rec in recs:
|
||||
try:
|
||||
values = rec._convert_to_write({
|
||||
|
|
Loading…
Reference in New Issue