|
|
@ -22,6 +22,7 @@ |
|
|
|
|
|
|
|
from openerp.osv import orm |
|
|
|
import openerp.tools as tools |
|
|
|
from openerp.tools.translate import _ |
|
|
|
from lxml import etree |
|
|
|
|
|
|
|
|
|
|
@ -31,6 +32,9 @@ class MassEditingWizard(orm.TransientModel): |
|
|
|
def fields_view_get( |
|
|
|
self, cr, uid, view_id=None, view_type='form', context=None, |
|
|
|
toolbar=False, submenu=False): |
|
|
|
s_set = _("Set") |
|
|
|
s_add = _("Add") |
|
|
|
s_remove = _("Remove") |
|
|
|
result = super(MassEditingWizard, self).fields_view_get( |
|
|
|
cr, uid, view_id, view_type, context, toolbar, submenu) |
|
|
|
if context.get('mass_editing_object'): |
|
|
@ -54,8 +58,8 @@ class MassEditingWizard(orm.TransientModel): |
|
|
|
'type': 'selection', |
|
|
|
'string': field_info[field.name]['string'], |
|
|
|
'selection': [ |
|
|
|
('set', 'Set'), ('remove_m2m', 'Remove'), |
|
|
|
('add', 'Add')]} |
|
|
|
('add', s_add), ('set', s_set), |
|
|
|
('remove_m2m', s_remove)]} |
|
|
|
xml_group = etree.SubElement(xml_group, 'group', { |
|
|
|
'colspan': '4'}) |
|
|
|
etree.SubElement(xml_group, 'separator', { |
|
|
@ -73,7 +77,7 @@ class MassEditingWizard(orm.TransientModel): |
|
|
|
all_fields["selection__" + field.name] = { |
|
|
|
'type': 'selection', |
|
|
|
'string': field_info[field.name]['string'], |
|
|
|
'selection': [('set', 'Set'), ('remove', 'Remove')]} |
|
|
|
'selection': [('set', s_set), ('remove', s_remove)]} |
|
|
|
all_fields[field.name] = { |
|
|
|
'type': field.ttype, 'string': field.field_description, |
|
|
|
'relation': field.relation} |
|
|
@ -88,7 +92,7 @@ class MassEditingWizard(orm.TransientModel): |
|
|
|
all_fields["selection__" + field.name] = { |
|
|
|
'type': 'selection', |
|
|
|
'string': field_info[field.name]['string'], |
|
|
|
'selection': [('set', 'Set'), ('remove', 'Remove')]} |
|
|
|
'selection': [('set', s_set), ('remove', s_remove)]} |
|
|
|
all_fields[field.name] = { |
|
|
|
'type': field.ttype, 'string': field.field_description, |
|
|
|
'relation': field.relation} |
|
|
@ -103,7 +107,7 @@ class MassEditingWizard(orm.TransientModel): |
|
|
|
all_fields["selection__" + field.name] = { |
|
|
|
'type': 'selection', |
|
|
|
'string': field_info[field.name]['string'], |
|
|
|
'selection': [('set', 'Set'), ('remove', 'Remove')]} |
|
|
|
'selection': [('set', s_set), ('remove', s_remove)]} |
|
|
|
all_fields[field.name] = { |
|
|
|
'type': field.ttype, 'string': field.field_description, |
|
|
|
'size': field.size or 256} |
|
|
@ -121,7 +125,7 @@ class MassEditingWizard(orm.TransientModel): |
|
|
|
all_fields["selection__" + field.name] = { |
|
|
|
'type': 'selection', |
|
|
|
'string': field_info[field.name]['string'], |
|
|
|
'selection': [('set', 'Set'), ('remove', 'Remove')]} |
|
|
|
'selection': [('set', s_set), ('remove', s_remove)]} |
|
|
|
etree.SubElement(xml_group, 'field', { |
|
|
|
'name': "selection__" + field.name, 'colspan': '2'}) |
|
|
|
etree.SubElement(xml_group, 'field', { |
|
|
@ -139,7 +143,7 @@ class MassEditingWizard(orm.TransientModel): |
|
|
|
all_fields["selection__" + field.name] = { |
|
|
|
'type': 'selection', |
|
|
|
'string': field_info[field.name]['string'], |
|
|
|
'selection': [('set', 'Set'), ('remove', 'Remove')]} |
|
|
|
'selection': [('set', s_set), ('remove', s_remove)]} |
|
|
|
if field.ttype == 'text': |
|
|
|
xml_group = etree.SubElement(xml_group, 'group', { |
|
|
|
'colspan': '6'}) |
|
|
@ -159,7 +163,7 @@ class MassEditingWizard(orm.TransientModel): |
|
|
|
'type': 'selection', |
|
|
|
'string': field_info[field.name]['string'], |
|
|
|
'selection': [( |
|
|
|
'set', 'Set'), ('remove', 'Remove')]} |
|
|
|
'set', s_set), ('remove', s_remove)]} |
|
|
|
etree.SubElement(xml_group, 'field', { |
|
|
|
'name': "selection__" + field.name, |
|
|
|
'colspan': '2', }) |
|
|
@ -172,12 +176,14 @@ class MassEditingWizard(orm.TransientModel): |
|
|
|
etree.SubElement( |
|
|
|
xml_form, 'separator', {'string': '', 'colspan': '4'}) |
|
|
|
xml_group3 = etree.SubElement(xml_form, 'footer', {}) |
|
|
|
s_apply = _("Apply") |
|
|
|
etree.SubElement(xml_group3, 'button', { |
|
|
|
'string': 'Apply', 'icon': "gtk-execute", |
|
|
|
'string': s_apply, 'icon': "gtk-execute", |
|
|
|
'type': 'object', 'name': "action_apply", |
|
|
|
'class': "oe_highlight"}) |
|
|
|
s_close = _("Close") |
|
|
|
etree.SubElement(xml_group3, 'button', { |
|
|
|
'string': 'Close', 'icon': "gtk-close", 'special': 'cancel'}) |
|
|
|
'string': s_close, 'icon': "gtk-close", 'special': 'cancel'}) |
|
|
|
root = xml_form.getroottree() |
|
|
|
result['arch'] = etree.tostring(root) |
|
|
|
result['fields'] = all_fields |
|
|
|