Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

求助!openerp中project management模块,新的project添加member时的困惑



  •       openerp中的project management模块,新的project添加member时,如果用户1已经是其他project的参与者时,我希望在添加member时不再显示这个用户1,就是将已属于其他project的人过滤一下,不再显示。<br />      但不知如何过滤?希望高手指教一下,谢谢!



  • 这么长时间也没人回个贴。<br />

    <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;page string=&quot;Members&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field colspan=&quot;4&quot; name=&quot;members&quot; nolabel=&quot;1&quot; context=&quot;{&#039;filter_member&#039;:&#039;1&#039;}&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tree string=&quot;Members&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;user_email&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;address_id&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/tree&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/page&gt;<br />
    

    <br />

    <br />&nbsp; &nbsp; class res_user(osv.osv):<br />&nbsp; &nbsp; &nbsp; &nbsp; _inherit = &#039;res.users&#039;<br />&nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp; def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if context and context.get(&#039;filter_member&#039;):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &#039;context:&#039;, context<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; project_obj = self.pool.get(&#039;project.project&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; project_ids = project_obj.search(cr, user, &#91;])<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unavailable_users = &#91;]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for project in project_obj.browse(cr, user, project_ids, context):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if project.state in (&#039;open&#039;, &#039;pending&#039;,&#039;draft&#039;) :<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for member in project.members:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unavailable_users += [member.id]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; available_members = self.search(cr,user, [(&#039;id&#039;,&#039;not in&#039;, unavailable_users)])<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; args.append((&#039;id&#039;,&#039;in&#039;,available_members))<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return super(res_user, self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)<br />&nbsp; &nbsp;  <br />&nbsp; &nbsp; res_user()<br />
    

    <br />版权所有,翻版有理。<br />