Community: Framework mailing list archives

expert-framework@mail.odoo.com

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

by
Stefan Reisich
- 09/19/2014 06:36:55

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 ''

Kind regards
Stefan Reisich
www.rove.de