← Back to team overview

openerp-india team mailing list archive

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

 

Hi,

>From your point of view, this is considered as low, I understand well, because this sparse fields are not used in OpenERP actually.
But this is now a feature of the framework and this bug totally prevents an usage of these fields. We use it as instance in magentoerpconnect.

I provided the fix, a branch and shown you how to reproduce the issue with a screencast.
If I'm not wrong, this is a very straightforward and little error and fix.
Moreover, if my fix were wrong (but I don't think so), nobody except the Magentoerpconnect modules editors (so mainly Akretion and us on trunk) would be impacted, but anyway it does not work at the moment...

So if someone can apply my patch, I would be grateful.

Thanks & have a nice day
Guewen

-- 
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:
  Confirmed

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