这么长时间也没人回个贴。
<br /> <page string="Members"><br /> <field colspan="4" name="members" nolabel="1" context="{'filter_member':'1'}"><br /> <tree string="Members"><br /> <field name="name"/><br /> <field name="user_email"/><br /> <field name="address_id"/><br /> </tree><br /> </field><br /> </page><br />
```
class res_user(osv.osv):
_inherit = 'res.users'
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
if context and context.get('filter_member'):
print 'context:', context
project_obj = self.pool.get('project.project')
project_ids = project_obj.search(cr, user, [])
unavailable_users = []
for project in project_obj.browse(cr, user, project_ids, context):
if project.state in ('open', 'pending','draft') :
for member in project.members:
unavailable_users += [member.id]
available_members = self.search(cr,user, [('id','not in', unavailable_users)])
args.append(('id','in',available_members))
return super(res_user, self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
res_user()
```
版权所有,翻版有理。