In a .py I have a many2one field that needs to restrict selection of users to a certain group. So I did this:
'user_id': fields.many2one('res.users', 'Restricted User', domain=[('id', 'in', ("select uid from res_groups_users_rel as r join res_groups as g on r.gid = g.id where g.name like 'restricted'"))]), and I tested with a static entry like this: 'user_id': fields.many2one('res.users', 'Restricted User', domain=[('id', 'in', (3, 6, 7))]), which works just fine. But the select does not work. It gives this error: Tue, 18 Dec 2007 02:30:52 ERROR:web-services:Exception in call: Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/tinyerp-server/netsvc.py", line 206, in _dispatch r=m(*params) File "/usr/lib/python2.5/site-packages/tinyerp-server/service/web_services.py", line 366, in execute res = service.execute(db, uid, object, method, *args) File "/usr/lib/python2.5/site-packages/tinyerp-server/osv/osv.py", line 111, in execute res = pool.execute_cr(cr, uid, obj, method, *args, **kw) File "/usr/lib/python2.5/site-packages/tinyerp-server/osv/osv.py", line 92, in execute_cr res = getattr(object,method)(cr, uid, *args, **kw) File "/usr/lib/python2.5/site-packages/tinyerp-server/addons/base/res/res_user.py", line 150, in name_search ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit) File "/usr/lib/python2.5/site-packages/tinyerp-server/osv/orm.py", line 1788, in search cr.execute('select %s.id from ' % self._table + ','.join(tables) +qu1+' order by '+order_by+limit_str+offset_str, qu2) File "/usr/lib/python2.5/site-packages/tinyerp-server/sql_db.py", line 73, in execute res = self.obj.execute(sql, p) TypeError: int argument required So I tried cutting and pasting the select statement into psql and it runs correctly. What is wrong here? It seems that it should work, but it doesn't. ???? Gerry _______________________________________________ Tinyerp-users mailing list http://tiny.be/mailman/listinfo/tinyerp-users
