[IMP] res.user form: hide groups in category 'Hidden'
bzr revid: rco@openerp.com-20120402145011-nw5d3nb8ap8r4hn9
This commit is contained in:
parent
f54f2c5509
commit
cbc70e12f0
|
@ -80,6 +80,7 @@ class module_category(osv.osv):
|
||||||
'description' : fields.text("Description", translate=True),
|
'description' : fields.text("Description", translate=True),
|
||||||
'sequence' : fields.integer('Sequence'),
|
'sequence' : fields.integer('Sequence'),
|
||||||
'visible' : fields.boolean('Visible'),
|
'visible' : fields.boolean('Visible'),
|
||||||
|
'xml_id': fields.function(osv.osv.get_external_id, type='char', size=128, string="External ID"),
|
||||||
}
|
}
|
||||||
_order = 'name'
|
_order = 'name'
|
||||||
|
|
||||||
|
|
|
@ -753,18 +753,20 @@ class groups_view(osv.osv):
|
||||||
xml1, xml2 = [], []
|
xml1, xml2 = [], []
|
||||||
xml1.append('<separator string="%s" colspan="4"/>' % _('Applications'))
|
xml1.append('<separator string="%s" colspan="4"/>' % _('Applications'))
|
||||||
for app, kind, gs in self.get_groups_by_application(cr, uid, context):
|
for app, kind, gs in self.get_groups_by_application(cr, uid, context):
|
||||||
|
# hide groups in category 'Hidden' (except to group_no_one)
|
||||||
|
attrs = 'groups="base.group_no_one"' if app and app.xml_id == 'base.module_category_hidden' else ''
|
||||||
if kind == 'selection':
|
if kind == 'selection':
|
||||||
# application name with a selection field
|
# application name with a selection field
|
||||||
field_name = name_selection_groups(map(int, gs))
|
field_name = name_selection_groups(map(int, gs))
|
||||||
xml1.append('<field name="%s"/>' % field_name)
|
xml1.append('<field name="%s" %s/>' % (field_name, attrs))
|
||||||
xml1.append('<newline/>')
|
xml1.append('<newline/>')
|
||||||
else:
|
else:
|
||||||
# application separator with boolean fields
|
# application separator with boolean fields
|
||||||
app_name = app and app.name or _('Other')
|
app_name = app and app.name or _('Other')
|
||||||
xml2.append('<separator string="%s" colspan="4"/>' % app_name)
|
xml2.append('<separator string="%s" colspan="4" %s/>' % (app_name, attrs))
|
||||||
for g in gs:
|
for g in gs:
|
||||||
field_name = name_boolean_group(g.id)
|
field_name = name_boolean_group(g.id)
|
||||||
xml2.append('<field name="%s"/>' % field_name)
|
xml2.append('<field name="%s" %s/>' % (field_name, attrs))
|
||||||
view.write({'arch': xml % ('\n'.join(xml1), '\n'.join(xml2))})
|
view.write({'arch': xml % ('\n'.join(xml1), '\n'.join(xml2))})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue