update the users list when the group changes
bzr revid: rco@openerp.com-20110401080620-hxumvekj26qgpb2k
This commit is contained in:
parent
7dbc2ba0b4
commit
e3fb801e9e
|
@ -122,6 +122,16 @@ class portal(osv.osv):
|
||||||
# set the parent_menu_id to item_id
|
# set the parent_menu_id to item_id
|
||||||
return self.write(cr, uid, ids, {'parent_menu_id': item_id}, context)
|
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):
|
def _res_xml_id(self, cr, uid, module, xml_id):
|
||||||
""" return the resource id associated to the given xml_id """
|
""" return the resource id associated to the given xml_id """
|
||||||
data_obj = self.pool.get('ir.model.data')
|
data_obj = self.pool.get('ir.model.data')
|
||||||
|
|
|
@ -36,7 +36,8 @@ portal's users.
|
||||||
<notebook>
|
<notebook>
|
||||||
<page string="Users">
|
<page string="Users">
|
||||||
<group colspan="4">
|
<group colspan="4">
|
||||||
<field name="group_id"/>
|
<field name="group_id"
|
||||||
|
on_change="onchange_group(group_id)"/>
|
||||||
</group>
|
</group>
|
||||||
<field name="user_ids" nolabel="1" colspan="4"
|
<field name="user_ids" nolabel="1" colspan="4"
|
||||||
context="{'menu_id': menu_action_id}"/>
|
context="{'menu_id': menu_action_id}"/>
|
||||||
|
|
Loading…
Reference in New Issue