← Back to team overview

openerp-india team mailing list archive

[Bug 912203] Re: [trunk] Sparse field : AttributeError: 'sparse' object has no attribute 'relation'

 

Hello,

That's not so trivial because you need a serialized field and sparse fields linked to this serialized field. 
At least one must be a many2one / m2m / o2m and one must not be a relation (in order not to have a "relation" attribute).

Here is a screencast of what you can do to issue this bug :
http://www.screencast.com/t/VE24jk2WPatk

Thanks

** Changed in: openobject-server
       Status: Incomplete => New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/912203

Title:
  [trunk] Sparse field : AttributeError: 'sparse' object has no
  attribute 'relation'

Status in OpenERP Server:
  New

Bug description:
  Hello,

  It concerns the sparse field recently introduced in the trunk version.
  I made a merge proposal here : https://code.launchpad.net/~c2c/openobject-server/trunk-server-sparse-fix-gbr/+merge/87595

  An error may occur when multi sparse field are stored in a serialized field and at least one is a m2o, m2m or o2m.
  The current code call self.relation, but as we loop on field_names, it should be obj._columns[field_name].relation

  Traceback (most recent call last):
    File "/home/gbaconnier/code/camptocamp/alpha/src/server/openerp/osv/osv.py", line 120, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/gbaconnier/code/camptocamp/alpha/src/server/openerp/osv/osv.py", line 172, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/gbaconnier/code/camptocamp/alpha/src/server/openerp/osv/osv.py", line 163, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/gbaconnier/code/camptocamp/alpha/src/server/openerp/osv/orm.py", line 3372, in read
      result = self._read_flat(cr, user, select, fields, context, load)
    File "/home/gbaconnier/code/camptocamp/alpha/src/server/openerp/osv/orm.py", line 3451, in _read_flat
      res2 = self.pool.get(table).read(cr, user, [x[col] for x in res], cols, context, load)
    File "/home/gbaconnier/code/camptocamp/alpha/src/server/openerp/osv/orm.py", line 3372, in read
      result = self._read_flat(cr, user, select, fields, context, load)
    File "/home/gbaconnier/code/camptocamp/alpha/src/server/openerp/osv/orm.py", line 3483, in _read_flat
      res2 = self._columns[val[0]].get(cr, self, ids, val, user, context=context, values=res)
    File "/home/gbaconnier/code/camptocamp/alpha/src/server/openerp/osv/fields.py", line 1048, in get
      result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
    File "/home/gbaconnier/code/camptocamp/alpha/src/server/openerp/osv/fields.py", line 1280, in _fnct_read
      relation_obj = obj.pool.get(self.relation)
  AttributeError: 'sparse' object has no attribute 'relation'

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/912203/+subscriptions


References