Community: Framework mailing list archives

expert-framework@mail.odoo.com

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

by
initOS GmbH, Torsten Francke
- 09/19/2014 08:41:44
add _set_image(self) before defining the fields


On 19.09.2014 13:01, Stefan Reisich - Rove.design GmbH wrote:
> 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
> 

-- 
Dipl.-Comp.-Math. Markus Schneider
Softwareentwickler

initOS GmbH & Co. KG
An der Eisenbahn 1
21224 Rosengarten

Mobil:   +49 (0)172 2303699
Phone:   +49 (0)4105 5615613
Fax:     +49 (0)4105 5615610

Email:   markus.schneider@initos.com
Web:     http://www.initos.com

Geschäftsführung:
Dipl. Wirt.-Inf. Frederik Kramer & Dipl.-Ing. (FH) Torsten Francke
Haftende Gesellschafterin: initOS Verwaltungs GmbH

Sitz der Gesellschaft: Rosengarten – Klecken
Amtsgericht Tostedt, HRA 201840
USt-IdNr: DE 275698169
Steuer-Nr: 15/205/21402