Community: Framework mailing list archives

Re: [8.0] New API: Field x is accessed before being computed.

Camptocamp France SAS, Alexandre Fayolle - Camptocamp
- 09/19/2014 07:43:17
On 19/09/2014 13:01, Stefan Reisich - GmbH wrote:
<blockquote cite="" type="cite">

The following code returns an exception: Field product.template.image_small is accessed before being computed.
I don't understand why. Maybe a bug in the new api?

from openerp import models, fields

class product_template(models.Model):
    _inherit = 'product.template'

    image = fields.Binary('Image', compute='_set_image')
    image_medium = fields.Binary('Medium-sized image', compute='_set_image')
    image_small = fields.Binary('Small-sized image', compute='_set_image')

   def _set_image(self):
        print self

        return ''

Could you share the full stack trace?

Alexandre Fayolle
Chef de Projet
Tel : + 33 (0)4 79 26 57 94

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex