From 1a535b9d870ced75d9b561bd0bb634c87b1fa999 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 6 May 2015 14:37:56 +0200 Subject: [PATCH] [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. --- openerp/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openerp/models.py b/openerp/models.py index 6beffe5072f..f584c72ada6 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -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({