Community: Framework mailing list archives

expert-framework@mail.odoo.com

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

by
Stefan Reisich
- 09/19/2014 07:43:42
Thank you very much.

Kind regards
Stefan Reisich
www.rove.de

Am 19.09.2014 um 13:32 schrieb Pedro Manuel Baeza Romero:
<blockquote cite="mid:CACSANCBrAKUSFEOB6GayjDBMTg8euEc166rKOVOEa_ZDQc2gAg@mail.gmail.com" type="cite">
That it's because you are not writing any value in _set_image. Put at least:

   def _set_image(self):
        self.image = False
        self.image_medium = False
        self.image_small = False


and it will work.

Regards

2014-09-19 12:58 GMT+02:00 Stefan Reisich - Rove.design GmbH <stefan.reisich@rove.de>:

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

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe