This question has been flagged
1 Reply
5350 Views

Good morning,

I just tried to export some users so as to get the field names so as to be able to re-import a much larger list in the future.

It works fine as long as I do not include the field "Technical Features". If I do add it, exporting fails, silently.

However my server side log shows:

2013-04-19 19:29:14,807 19350 ERROR test_db openerp.netsvc: 
   Field 'in_group_6' does not exist in object 'browse_record(res.users, 1)'

Traceback (most recent call last):


File "/opt/openerp/server/openerp/netsvc.py", line 293, in dispatch_rpc
  result = ExportService.getService(service_name).dispatch(method, params)

File "/opt/openerp/server/openerp/service/web_services.py", line 618, in dispatch
  res = fn(db, uid, *params)

File "/opt/openerp/server/openerp/osv/osv.py", line 188, in execute_kw
  return self.execute(db, uid, obj, method, *args, **kw or {})

File "/opt/openerp/server/openerp/osv/osv.py", line 131, in wrapper
  return f(self, dbname, *args, **kwargs)

File "/opt/openerp/server/openerp/osv/osv.py", line 197, in execute
  res = self.execute_cr(cr, uid, obj, method, *args, **kw)

File "/opt/openerp/server/openerp/osv/osv.py", line 185, in execute_cr
  return getattr(object, method)(cr, uid, *args, **kw)

File "/opt/openerp/server/openerp/osv/orm.py", line 1230, in export_data
  datas += self.__export_row(cr, uid, row, fields_to_export, context)

File "/opt/openerp/server/openerp/osv/orm.py", line 1147, in __export_row
  r = r[f[i]]

File "/opt/openerp/server/openerp/osv/orm.py", line 383, in __getitem__
  raise KeyError(error_msg) 

 KeyError: u"Field 'in_group_6' does not exist in object 'browse_record(res.users, 1)'"

If it does not exist why is it in the list? If it does exist, what is the correct way to access it?

Two weeks ago I asked this question.
https://accounts.openerp.com/forum/Help-1/question/10397/

I believe it is the same problem.

Update: 2013/04/24

Ray's suggestion is correct. After adjusting the patch for V7 it did make export possible. https://gist.github.com/martinhbramwell/5443701

However, importing still fails, as does any attempt to access those fields with XMLRPC.

The supplied patch looks like a highly specific fix created to paper over one symptom of a general design flaw. Look :

if    f[i].startswith('in_group_') 
   or f[i].startswith('in_groups_') 
   or f[i].startswith('sel_groups_'):
      r = self.read(cr, uid, row.id, [f[i]], context)[f[i]]
else:
      r = r[f[i]]

I don't understand the ORM code well enough even to be able to say for sure whether that kluge is legitimate, but such if statements sure do have that wallpaper glue smell to them.

Avatar
Discard
Best Answer

I'm not sure if this is related, but it reminds me of a bug from 6.1:

https://bugs.launchpad.net/openobject-server/+bug/985329

Avatar
Discard
Author

Please see my update. (sorry for the delay. it took a while for that to percolate back to the top of the priority stack)