Browse Source

[IMP] Added one2many handling

pull/5/head
Sabrina Romero 12 years ago
committed by Pedro M. Baeza
parent
commit
07bed6e790
  1. 2
      mass_editing/mass_editing_view.xml
  2. 13
      mass_editing/wizard/mass_editing_wizard.py

2
mass_editing/mass_editing_view.xml

@ -14,7 +14,7 @@
<notebook colspan="4">
<page string="Fields">
<field name="field_ids" colspan="4" nolabel="1"
domain="[('ttype', 'not in', ['one2many', 'reference', 'function']), ('model_id', 'in', model_ids[0][2])]"/>
domain="[('ttype', 'not in', ['reference', 'function']), ('model_id', 'in', model_ids[0][2])]"/>
</page>
<page string="Advanced">
<group colspan="2" col="2">

13
mass_editing/wizard/mass_editing_wizard.py

@ -49,6 +49,19 @@ class mass_editing_wizard(orm.TransientModel):
etree.SubElement(xml_group, 'separator', {'string': field_info[field.name]['string'], 'colspan': '2'})
etree.SubElement(xml_group, 'field', {'name': "selection__" + field.name, 'colspan': '2', 'nolabel':'1'})
etree.SubElement(xml_group, 'field', {'name': field.name, 'colspan':'4', 'nolabel':'1', 'attrs':"{'invisible':[('selection__" + field.name + "','=','remove_m2m')]}"})
elif field.ttype == "one2many":
all_fields["selection__" + field.name] = {'type':'selection',
'string': field_info[field.name]['string'],
'selection':[('set', 'Set'),
('remove', 'Remove')]}
all_fields[field.name] = {'type':field.ttype,
'string': field.field_description,
'relation': field.relation}
etree.SubElement(xml_group, 'field',
{'name': "selection__" + field.name, 'colspan':'2'})
etree.SubElement(xml_group, 'field',
{'name': field.name, 'colspan':'4', 'nolabel':'1',
'attrs':"{'invisible':[('selection__" + field.name + "','=','remove_o2m')]}"})
elif field.ttype == "many2one":
all_fields["selection__" + field.name] = {'type':'selection', 'string': field_info[field.name]['string'], 'selection':[('set', 'Set'), ('remove', 'Remove')]}
all_fields[field.name] = {'type':field.ttype, 'string': field.field_description, 'relation': field.relation}

Loading…
Cancel
Save