← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 788820] Re: child_of for id field bug report

 

Thank you. I see I made mistake.
I apologize for wrong bug report.

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/788820

Title:
  child_of for id field bug report

Status in OpenERP Server:
  Invalid

Bug description:
  For special application I have added parent_id field in user object:

  class users(osv.osv):
      _inherit = 'res.users'
      _description = "Users"
      _columns = {
          'parent_id': fields.many2one('res.users', 'Parent User'),
          'child_ids': fields.one2many('res.users', 'parent_id', string='Children Users'),
      }

  When I make some hierarchy of users I want to add domain or
  permissions for that users.

  Then I try to use domain in action (in xml view definition):
  [('id','child_of',uid)]

  or I try to define record rule for users object:
  [('id','child_of',user.id)]

  and I get always bug report:

  Environment Information : 
  System : Linux-2.6.32-31-generic-i686-with-Ubuntu-10.04-lucid
  OS Name : posix
  Distributor ID:	Ubuntu
  Description:	Ubuntu 10.04.2 LTS
  Release:	10.04
  Codename:	lucid
  Operating System Release : 2.6.32-31-generic
  Operating System Version : #61-Ubuntu SMP Fri Apr 8 18:24:35 UTC 2011
  Operating System Architecture : 32bit
  Operating System Locale : en_US.UTF8
  Python Version : 2.6.5
  OpenERP-Client Version : 6.0.2
  Last revision No. & ID :1835 launchpad_translations_on_behalf_of_openerp-20110413143452-vuta882s04fsp92t
  Traceback (most recent call last):
    File "/home/openerp/production/server/bin/netsvc.py", line 489, in dispatch
      result = ExportService.getService(service_name).dispatch(method, auth, params)
    File "/home/openerp/production/server/bin/service/web_services.py", line 599, in dispatch
      res = fn(db, uid, *params)
    File "/home/openerp/production/server/bin/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/openerp/production/server/bin/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/openerp/production/server/bin/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/openerp/production/server/bin/osv/orm.py", line 1743, in search
      return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
    File "/home/openerp/production/server/bin/osv/orm.py", line 4012, in _search
      query = self._where_calc(cr, user, args, context=context)
    File "/home/openerp/production/server/bin/osv/orm.py", line 3865, in _where_calc
      e.parse(cr, user, self, context)
    File "/home/openerp/production/server/bin/osv/expression.py", line 138, in parse
      dom = _rec_get(right, working_table)
    File "/home/openerp/production/server/bin/osv/expression.py", line 106, in _rec_get
      return [(left, 'in', rg(ids, table, parent or table._parent_name))]
    File "/home/openerp/production/server/bin/osv/expression.py", line 104, in rg
      ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context)
    File "/home/openerp/production/server/bin/osv/orm.py", line 1743, in search
      return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
    File "/home/openerp/production/server/bin/osv/orm.py", line 4012, in _search
      query = self._where_calc(cr, user, args, context=context)
    File "/home/openerp/production/server/bin/osv/orm.py", line 3867, in _where_calc
      where_clause, where_params = e.to_sql()
    File "/home/openerp/production/server/bin/osv/expression.py", line 490, in to_sql
      q, p = self.__leaf_to_sql(e, table)
    File "/home/openerp/production/server/bin/osv/expression.py", line 402, in __leaf_to_sql
      params = right and right[:] or []
  TypeError: 'int' object is unsubscriptable

  I think it should work for id field as for any other fields.


References