Odoo Help

0

What's the correct way to access "Technical Features"?

By
Martin
on 4/22/13, 8:28 AM 2,355 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.

1
Ray Carnes
On 4/22/13, 7:51 PM

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

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

Martin
on 4/24/13, 7:28 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 4/22/13, 8:28 AM
Seen: 2355 times
Last updated: 3/16/15, 8:10 AM