[FIX] base: update reifed view for users with new grid form
Replace some layout magic with some layout determinism; in particular, the view attempted to have a 4 column layout which is not well supported in grid form views. This commit instead create a "normal" structure (outer group > inner group) for "boolean" group access (e.g. 'Extra Rights' or 'Technical' sections of the user form access groups, whilst in debug mode). closes odoo/odoo#102789 X-original-commit: fd854e87d8a138052302afbd3da486f41102c695 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
This commit is contained in:
committed by
Adrien Dieudonne
parent
94beb218ea
commit
b903a355f7
@@ -1401,15 +1401,22 @@ class GroupsView(models.Model):
|
||||
else:
|
||||
# application separator with boolean fields
|
||||
app_name = app.name or 'Other'
|
||||
xml4.append(E.separator(string=app_name, colspan="4", **attrs))
|
||||
xml4.append(E.separator(string=app_name, **attrs))
|
||||
left_group, right_group = [], []
|
||||
attrs['attrs'] = user_type_readonly
|
||||
# we can't use enumerate, as we sometime skip groups
|
||||
group_count = 0
|
||||
for g in gs:
|
||||
field_name = name_boolean_group(g.id)
|
||||
dest_group = left_group if group_count % 2 == 0 else right_group
|
||||
if g == group_no_one:
|
||||
# make the group_no_one invisible in the form view
|
||||
xml4.append(E.field(name=field_name, invisible="1", **attrs))
|
||||
dest_group.append(E.field(name=field_name, invisible="1", **attrs))
|
||||
else:
|
||||
xml4.append(E.field(name=field_name, **attrs))
|
||||
dest_group.append(E.field(name=field_name, **attrs))
|
||||
group_count += 1
|
||||
xml4.append(E.group(*left_group))
|
||||
xml4.append(E.group(*right_group))
|
||||
|
||||
xml4.append({'class': "o_label_nowrap"})
|
||||
if user_type_field_name:
|
||||
@@ -1419,12 +1426,13 @@ class GroupsView(models.Model):
|
||||
|
||||
for xml_cat in sorted(xml_by_category.keys(), key=lambda it: it[0]):
|
||||
master_category_name = xml_cat[1]
|
||||
xml3.append(E.group(*(xml_by_category[xml_cat]), col="2", string=master_category_name))
|
||||
xml3.append(E.group(*(xml_by_category[xml_cat]), string=master_category_name))
|
||||
|
||||
field_name = 'user_group_warning'
|
||||
user_group_warning_xml = E.div({
|
||||
'class': "alert alert-warning",
|
||||
'role': "alert",
|
||||
'colspan': "2",
|
||||
'attrs': str({'invisible': [(field_name, '=', False)]})
|
||||
})
|
||||
user_group_warning_xml.append(E.label({
|
||||
@@ -1437,10 +1445,10 @@ class GroupsView(models.Model):
|
||||
|
||||
xml = E.field(
|
||||
*(xml0),
|
||||
E.group(*(xml1), col="2", groups="base.group_no_one"),
|
||||
E.group(*(xml2), col="4", attrs=str(user_type_attrs)),
|
||||
E.group(*(xml3), col="2", attrs=str(user_type_attrs)),
|
||||
E.group(*(xml4), col="4", attrs=str(user_type_attrs), groups="base.group_no_one"), name="groups_id", position="replace")
|
||||
E.group(*(xml1), groups="base.group_no_one"),
|
||||
E.group(*(xml2), attrs=str(user_type_attrs)),
|
||||
E.group(*(xml3), attrs=str(user_type_attrs)),
|
||||
E.group(*(xml4), attrs=str(user_type_attrs), groups="base.group_no_one"), name="groups_id", position="replace")
|
||||
xml.addprevious(etree.Comment("GENERATED AUTOMATICALLY BY GROUPS"))
|
||||
|
||||
# serialize and update the view
|
||||
|
||||
Reference in New Issue
Block a user