From: Raphael Collet Date: Wed, 22 Oct 2014 15:00:23 +0000 (+0200) Subject: [IMP] fields: initialized computed fields to a null value instead of a failed one X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=0873613767747454b97ce0edc9cb0ce7c7067185;p=odoo%2Fodoo.git [IMP] fields: initialized computed fields to a null value instead of a failed one This should ease compute methods that assign a list to "update" a one2many/many2many field. With a failed value, the update crashes. --- diff --git a/openerp/fields.py b/openerp/fields.py index ba3c5be..7852c0d 100644 --- a/openerp/fields.py +++ b/openerp/fields.py @@ -792,11 +792,9 @@ class Field(object): def _compute_value(self, records): """ Invoke the compute method on `records`. """ - # mark the computed fields failed in cache, so that access before - # computation raises an exception - exc = Warning("Field %s is accessed before being computed." % self) + # initialize the fields to their corresponding null value in cache for field in self.computed_fields: - records._cache[field] = FailedValue(exc) + records._cache[field] = field.null(records.env) records.env.computed[field].update(records._ids) self.compute(records) for field in self.computed_fields: