Technical mailing list archives

Re: v8.0 - Cannot create computed field - Field is accessed before being computed.

- 10/16/2014 05:50:40

Typically you would get this error if your compute method dooesn't set the corresponding field value, the common mistake being trying to return the value.

So make sure your _data_get() does this:

def _data_get(self):
  # compute value
  self.datas = value

And not this :

def _data_get(self):
  # compute value
  return value

On Wed, Oct 15, 2014 at 1:37 AM, Maxim Litnitskiy <> wrote:
Hi dear Experts.
In old api we had no problems creating function fields like the following (from

'datas': fields.function(_data_get, fnct_inv=_data_set, string='File Content', type="binary", nodrop=True),  
In new api the following code is working on read / update, but gives error "Field is accessed..."  on create:

datas = fields.Binary(compute='_data_get', inverse='_data_set', string=_('File content'), required=True)

Is it supposed to work or not?

P.S. May be some concept has changed. I can imagine that in form edit mode I use real Binary field (not computed) and mirror it via @api.depend on computed field? 

Post to: