Browse Source

Fix label disappearing with many2many field

When adding a many2many field or text field to the wizard, all the labels were gone.
I've removed the separator tag as long as the extra redefined xml_group.
There is still something not working: the "attrs" attribute are not ported to the form.
pull/78/head
Martronic SA 6 years ago
committed by GitHub
parent
commit
d899e8d4be
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 48
      mass_editing/wizard/mass_editing_wizard.py

48
mass_editing/wizard/mass_editing_wizard.py

@ -31,14 +31,6 @@ class MassEditingWizard(models.TransientModel):
'colspan': '6',
'col': '6',
})
etree.SubElement(xml_group, 'label', {
'string': '',
'colspan': '2',
})
xml_group = etree.SubElement(xml_form, 'group', {
'colspan': '6',
'col': '6',
})
model_obj = self.env[context.get('active_model')]
field_info = model_obj.fields_get()
for field in editing_data.field_ids:
@ -51,22 +43,13 @@ class MassEditingWizard(models.TransientModel):
('remove_m2m', 'Remove'),
('add', 'Add')]
}
xml_group = etree.SubElement(xml_group, 'group', {
'colspan': '6',
'col': '6',
})
etree.SubElement(xml_group, 'separator', {
'string': field_info[field.name]['string'],
'colspan': '6',
})
etree.SubElement(xml_group, 'field', {
'name': "selection__" + field.name,
'colspan': '6',
'nolabel': '1'
'colspan': '2',
})
etree.SubElement(xml_group, 'field', {
'name': field.name,
'colspan': '6',
'colspan': '4',
'nolabel': '1',
'attrs': ("{'invisible': [('selection__" +
field.name + "', '=', 'remove_m2m')]}"),
@ -164,33 +147,6 @@ class MassEditingWizard(models.TransientModel):
'type': field.ttype,
'string': field.field_description,
}
all_fields["selection__" + field.name] = {
'type': 'selection',
'string': field_info[field.name]['string'],
'selection': [('set', 'Set'), ('remove', 'Remove')]
}
if field.ttype == 'text':
xml_group = etree.SubElement(xml_group, 'group', {
'colspan': '6',
'col': '6',
})
etree.SubElement(xml_group, 'separator', {
'string': all_fields[field.name]['string'],
'colspan': '6',
})
etree.SubElement(xml_group, 'field', {
'name': "selection__" + field.name,
'colspan': '6',
'nolabel': '1',
})
etree.SubElement(xml_group, 'field', {
'name': field.name,
'colspan': '6',
'nolabel': '1',
'attrs': ("{'invisible':[('selection__" +
field.name + "','=','remove')]}"),
})
else:
all_fields["selection__" + field.name] = {
'type': 'selection',
'string': field_info[field.name]['string'],

Loading…
Cancel
Save