update the users list when the group changes

bzr revid: rco@openerp.com-20110401080620-hxumvekj26qgpb2k
This commit is contained in:
Raphael Collet 2011-04-01 10:06:20 +02:00
parent 7dbc2ba0b4
commit e3fb801e9e
2 changed files with 12 additions and 1 deletions

View File

@ -122,6 +122,16 @@ class portal(osv.osv):
# set the parent_menu_id to item_id
return self.write(cr, uid, ids, {'parent_menu_id': item_id}, context)
def onchange_group(self, cr, uid, ids, group_id, context=None):
""" update the users list when the group changes """
user_ids = False
if group_id:
group = self.pool.get('res.groups').browse(cr, uid, group_id, context)
user_ids = [u.id for u in group.users]
return {
'value': {'user_ids': user_ids}
}
def _res_xml_id(self, cr, uid, module, xml_id):
""" return the resource id associated to the given xml_id """
data_obj = self.pool.get('ir.model.data')

View File

@ -36,7 +36,8 @@ portal's users.
<notebook>
<page string="Users">
<group colspan="4">
<field name="group_id"/>
<field name="group_id"
on_change="onchange_group(group_id)"/>
</group>
<field name="user_ids" nolabel="1" colspan="4"
context="{'menu_id': menu_action_id}"/>