Browse Source

[IMP]Improved Mass Editing Functionality and also improved code as per Travis python code

Krunal Soni 9 years ago
parent
commit
44f328daf8

+ 2 - 1
mass_editing/__init__.py

@@ -2,7 +2,8 @@
 ##############################################################################
 #
 #    This module uses OpenERP, Open Source Management Solution Framework.
-#    Copyright (C) 2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2012-Today Serpent Consulting Services.
+#    (<http://www.serpentcs.com>)
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by

+ 10 - 9
mass_editing/__openerp__.py

@@ -2,7 +2,8 @@
 ##############################################################################
 #
 #    This module uses OpenERP, Open Source Management Solution Framework.
-#    Copyright (C) 2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2012-Today Serpent Consulting Services.
+#    (<http://www.serpentcs.com>)
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
@@ -19,14 +20,14 @@
 #
 ##############################################################################
 {
-    "name" : "Mass Editing",
-    "version" : "2.0",
-    "author" : "Serpent Consulting Services Pvt. Ltd.",
-    "category" : "Tools",
-    "website" : "http://www.serpentcs.com",
-    "description": """This module provides the functionality to add, update or remove the values of more than one records on the fly at the same time.
-        You can configure mass editing for any ODOO model. 
-    . 
+    "name": "Mass Editing",
+    "version": "2.0",
+    "author": "Serpent Consulting Services Pvt. Ltd.",
+    "category": "Tools",
+    "website": "http://www.serpentcs.com",
+    "description": """This module provides the below functionality:
+        Add, update or remove the values of more than one records on the fly at
+        the same time. You can configure mass editing for any ODOO model.
     """,
     'depends': ['base'],
     'data': [

+ 2 - 1
mass_editing/models/__init__.py

@@ -2,7 +2,8 @@
 ##############################################################################
 #
 #    This module uses OpenERP, Open Source Management Solution Framework.
-#    Copyright (C) 2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2012-Today Serpent Consulting Services.
+#    (<http://www.serpentcs.com>)
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by

+ 50 - 35
mass_editing/models/mass_editing.py

@@ -2,7 +2,8 @@
 ##############################################################################
 #
 #    This module uses OpenERP, Open Source Management Solution Framework.
-#    Copyright (C) 2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2012-Today Serpent Consulting Services.
+#    (<http://www.serpentcs.com>)
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
@@ -21,10 +22,12 @@
 
 from openerp import models, fields, api, _
 
+
 class IrModelFields(models.Model):
     _inherit = 'ir.model.fields'
 
-    @api.returns('self')  # If we keep @api.v7, we have to add @api.v8 code too.
+    # If we keep @api.v7, we have to add @api.v8 code too.
+    @api.returns('self')
     def search(
             self, cr, uid, args, offset=0, limit=0, order=None, context=None,
             count=False):
@@ -43,19 +46,24 @@ class IrModelFields(models.Model):
             context=context, count=count
         )
 
+
 class MassObject(models.Model):
     _name = "mass.object"
 
     name = fields.Char(string="Name", required=True, select=1)
-    model_id = fields.Many2one('ir.model', string='Model', required=False)
-    field_ids = fields.Many2many('ir.model.fields', 'mass_field_rel', 'mass_id', 'field_id', string='Fields')
-    ref_ir_act_window = fields.Many2one('ir.actions.act_window', string='Sidebar action', readonly=True,
-                                        help="Sidebar action to make this template available on records "
-                                             "of the related document model")
-    ref_ir_value = fields.Many2one('ir.values', string='Sidebar button', readonly=True,
-                                   help="Sidebar button to open the sidebar action")
-
-    model_ids = fields.Many2many('ir.model', string='Model List')
+    model_id = fields.Many2one('ir.model', string='Model', required=True,
+                    help="Model is used for Selecting Fields,"
+                    " This is editable until Sidebar menu is not created")
+    field_ids = fields.Many2many('ir.model.fields', 'mass_field_rel',
+                                 'mass_id', 'field_id', string='Fields')
+    ref_ir_act_window = fields.Many2one('ir.actions.act_window',
+                        string='Sidebar action',
+                        readonly=True,
+                        help="Sidebar action to make this template available"
+                             "on records of the related document model")
+    ref_ir_value = fields.Many2one('ir.values', string='Sidebar button',
+                        readonly=True,
+                        help="Sidebar button to open the sidebar action")
 
     model_list = fields.Char(string='Model List', size=256)
 
@@ -65,13 +73,19 @@ class MassObject(models.Model):
     @api.multi
     @api.onchange('model_id')
     def onchange_model(self):
-        if self._context is None: self._context = {}
-        if not self.model_id:
-            self.model_ids = [(6, 0, [])]
-
-        model_ids = [self.model_id.id]
-        self.model_ids = [[6, 0, model_ids]]
-        self.model_list = [self.model_ids.id]
+        self.field_ids = [(6, 0, [])]
+        model_list = []
+        if self.model_id:
+            model_obj = self.env['ir.model']
+            model_list = [self.model_id.id]
+            active_model_obj = self.env[self.model_id.model]
+            if active_model_obj._inherits:
+                for key, val in active_model_obj._inherits.items():
+                    inherits_model_list = model_obj.search(
+                                            [('model', '=', key)])
+                    model_list.extend(inherits_model_list and \
+                                      inherits_model_list.ids or [])
+        self.model_list = model_list
 
     @api.multi
     def create_action(self):
@@ -86,31 +100,28 @@ class MassObject(models.Model):
                  'src_model': src_obj,
                  'view_type': 'form',
                  'context': "{'mass_editing_object' : %d}" % (self.id),
-                 'view_mode':'form,tree',
+                 'view_mode': 'form, tree',
                  'target': 'new',
-                 'auto_refresh':1
+                 'auto_refresh': 1
             }).id
 
         vals['ref_ir_value'] = self.env['ir.values'].create({
-                 'name': button_name,
-                 'model': src_obj,
-                 'key2': 'client_action_multi',
-                 'value': "ir.actions.act_window," + str(vals['ref_ir_act_window']),
-                 'object': True,
-             }).id
-
-        self.write({
-                    'ref_ir_act_window': vals.get('ref_ir_act_window', False),
-                    'ref_ir_value': vals.get('ref_ir_value', False),
-                })
+         'name': button_name,
+         'model': src_obj,
+         'key2': 'client_action_multi',
+         'value': "ir.actions.act_window," + str(vals['ref_ir_act_window']),
+         'object': True,
+         }).id
+
+        self.write(vals)
         return True
 
     @api.one
     def unlink_action(self):
         if self.ref_ir_act_window:
-            self.env['ir.actions.act_window'].search([('id', '=', self.ref_ir_act_window.id)]).unlink()
+            self.ref_ir_act_window.unlink()
         if self.ref_ir_value:
-            self.env['ir_values'].search([('id', '=', self.ref_ir_value.id)]).unlink()
+            self.ref_ir_value.unlink()
 
     @api.one
     def unlink(self):
@@ -124,6 +135,7 @@ class MassObject(models.Model):
         default.update({'name': _("%s (copy)" % self.name), 'field_ids': []})
         return super(MassObject, self).copy(default)
 
+
 class IrModuleModule(models.Model):
 
     _inherit = 'ir.module.module'
@@ -133,8 +145,11 @@ class IrModuleModule(models.Model):
         # search window actions of mass editing  and delete it
         if self.name == 'mass_editing':
             values_obj = self.env['ir.values']
-            actions = self.env['ir.actions.act_window'].search ([('res_model', '=', 'mass.editing.wizard')])
+            actions = self.env['ir.actions.act_window'].search(
+                                   [('res_model', '=', 'mass.editing.wizard')])
             for action in actions:
-                values_obj.search([('value', '=', 'ir.actions.act_window,%s' % action.id)]).unlink()
+                values_obj.search(
+                      [('value', '=', 'ir.actions.act_window,%s' % action.id)]
+                                 ).unlink()
             actions.unlink()
         return super(IrModuleModule, self).module_uninstall()

+ 1 - 2
mass_editing/views/mass_editing_view.xml

@@ -10,8 +10,7 @@
                 <form string="Object">
                     <group>
                     <field name="name"/>
-                    <field name="model_id"/>
-                    <field name="model_ids" invisible="1"/>
+                    <field name="model_id" attrs="{'readonly':[('ref_ir_act_window','!=',False)]}"/>
                     <field name="model_list" invisible="1"/>
                     </group>
                     <notebook colspan="4">

+ 2 - 2
mass_editing/wizard/__init__.py

@@ -2,7 +2,8 @@
 ##############################################################################
 #
 #    This module uses OpenERP, Open Source Management Solution Framework.
-#    Copyright (C) 2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2012-Today Serpent Consulting Services.
+#    (<http://www.serpentcs.com>)
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
@@ -20,4 +21,3 @@
 ##############################################################################
 
 import mass_editing_wizard
-

+ 260 - 53
mass_editing/wizard/mass_editing_wizard.py

@@ -2,7 +2,8 @@
 ##############################################################################
 #
 #    This module uses OpenERP, Open Source Management Solution Framework.
-#    Copyright (C) 2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2012-Today Serpent Consulting Services
+#    (<http://www.serpentcs.com>)
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
@@ -19,79 +20,284 @@
 #
 ##############################################################################
 
-from openerp import models, fields, api, tools, _
+from openerp import models, fields, api, tools
 from lxml import etree
 
 
 class mass_editing_wizard(models.Model):
     _name = 'mass.editing.wizard'
 
-    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+    def fields_view_get(self, cr, uid, view_id=None, view_type='form',
+                        context=None, toolbar=False, submenu=False):
         if context is None:
             context = {}
-        result = super(mass_editing_wizard, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
+        result = super(mass_editing_wizard, self).fields_view_get(cr, uid,
+                                          view_id, view_type, context=context,
+                                          toolbar=toolbar, submenu=submenu)
         if context.get('mass_editing_object'):
-            mass_object = self.pool['mass.object'] 
-            editing_data = mass_object.browse(cr, uid, context.get('mass_editing_object'))
+            mass_object = self.pool['mass.object']
+            editing_data = mass_object.browse(cr, uid,
+                                          context.get('mass_editing_object'))
             all_fields = {}
-            xml_form = etree.Element('form', {'string': tools.ustr(editing_data.name), 'version':'7.0'})
-            xml_group = etree.SubElement(xml_form, 'group', {'colspan': '4'})
-            etree.SubElement(xml_group, 'label', {'string': '', 'colspan': '2'})
-            xml_group = etree.SubElement(xml_form, 'group', {'colspan': '4'})
+            xml_form = etree.Element('form', {
+                                      'string': tools.ustr(editing_data.name),
+                                      }
+                                    )
+            xml_group = etree.SubElement(xml_form, 'group', {
+                                                              '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.pool[context.get('active_model')]
             field_info = model_obj.fields_get(cr, uid)
             for field in editing_data.field_ids:
                 if field.ttype == "many2many":
-                    all_fields[field.name] = field_info[field.name] 
-                    all_fields["selection__" + field.name] = {'type':'selection', 'string': field_info[field.name]['string'], 'selection':[('set', 'Set'), ('remove_m2m', 'Remove'), ('add', 'Add')]}
-                    xml_group = etree.SubElement(xml_group, 'group', {'colspan': '4'})
-                    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}
+                    all_fields[field.name] = field_info[field.name]
+                    all_fields["selection__" + field.name] = {
+                                    'type': 'selection',
+                                    'string': field_info[field.name]['string'],
+                                    'selection': [
+                                                  ('set', 'Set'),
+                                                  ('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'
+                                      }
+                                    )
                     etree.SubElement(xml_group, 'field',
-                        {'name': "selection__" + field.name, 'colspan':'2'})
+                                     {
+                                      'name': field.name,
+                                      'colspan': '6',
+                                      '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': '4'
+                                            }
+                                    )
                     etree.SubElement(xml_group, 'field',
-                        {'name': field.name, 'colspan':'4', 'nolabel':'1',
-                            'attrs':"{'invisible':[('selection__" + field.name + "','=','remove_o2m')]}"})
+                                      {
+                                       'name': field.name,
+                                       'colspan': '6',
+                                       '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}
-                    etree.SubElement(xml_group, 'field', {'name': "selection__" + field.name, 'colspan':'2'})
-                    etree.SubElement(xml_group, 'field', {'name': field.name, 'nolabel':'1', 'colspan':'2', 'attrs':"{'invisible':[('selection__" + field.name + "','=','remove')]}"})
+                    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,
+                                       'nolabel': '1',
+                                       'colspan': '4',
+                                       'attrs': "{'invisible':[('selection__" \
+                                                + field.name + \
+                                                "','=','remove')]}"
+                                       }
+                                     )
                 elif field.ttype == "char":
-                    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, 'size': field.size or 256}
-                    etree.SubElement(xml_group, 'field', {'name': "selection__" + field.name, 'colspan':'2', 'colspan':'2'})
-                    etree.SubElement(xml_group, 'field', {'name': field.name, 'nolabel':'1', 'attrs':"{'invisible':[('selection__" + field.name + "','=','remove')]}", 'colspan':'2'})
+                    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,
+                                            'size': field.size or 256
+                                            }
+                    etree.SubElement(xml_group, 'field', {
+                                            'name': "selection__" + field.name,
+                                            'colspan': '2'
+                                            }
+                                     )
+                    etree.SubElement(xml_group, 'field', {
+                                       'name': field.name,
+                                       'nolabel': '1',
+                                       'attrs': "{'invisible':[('selection__" \
+                                                 + field.name + \
+                                                 "','=','remove')]}",
+                                       'colspan': '4'
+                                       }
+                                     )
                 elif field.ttype == 'selection':
-                    all_fields["selection__" + field.name] = {'type':'selection', 'string': field_info[field.name]['string'], 'selection':[('set', 'Set'), ('remove', 'Remove')]}
-                    etree.SubElement(xml_group, 'field', {'name': "selection__" + field.name, 'colspan':'2'})
-                    etree.SubElement(xml_group, 'field', {'name': field.name, 'nolabel':'1', 'colspan':'2', 'attrs':"{'invisible':[('selection__" + field.name + "','=','remove')]}"})
-                    all_fields[field.name] = {'type':field.ttype, 'string': field.field_description, 'selection': field_info[field.name]['selection']}
+                    all_fields["selection__" + field.name] = {
+                                    'type': 'selection',
+                                    'string': field_info[field.name]['string'],
+                                    'selection': [
+                                                  ('set', 'Set'),
+                                                  ('remove', 'Remove')
+                                                 ]
+                                    }
+                    etree.SubElement(xml_group, 'field', {
+                                          'name': "selection__" + field.name,
+                                          'colspan': '2'
+                                        }
+                                     )
+                    etree.SubElement(xml_group, 'field', {
+                                       'name': field.name,
+                                       'nolabel': '1',
+                                       'colspan': '4',
+                                       'attrs': "{'invisible':[('selection__" \
+                                                + field.name + \
+                                                "','=','remove')]}"
+                                            }
+                                     )
+                    all_fields[field.name] = {
+                            'type': field.ttype,
+                            'string': field.field_description,
+                            'selection': field_info[field.name]['selection']
+                           }
                 else:
-                    all_fields[field.name] = {'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')]}
+                    all_fields[field.name] = {
+                                              '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'})
-                        etree.SubElement(xml_group, 'separator', {'string': all_fields[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')]}"})
+                        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'], 'selection':[('set', 'Set'), ('remove', 'Remove')]}
-                        etree.SubElement(xml_group, 'field', {'name': "selection__" + field.name, 'colspan': '2', })
-                        etree.SubElement(xml_group, 'field', {'name': field.name, 'nolabel':'1', 'attrs':"{'invisible':[('selection__" + field.name + "','=','remove')]}", 'colspan': '2', })
-            etree.SubElement(xml_form, 'separator', {'string' : '', 'colspan': '4'})
+                        all_fields["selection__" + field.name] = {
+                                    'type': 'selection',
+                                    'string': field_info[field.name]['string'],
+                                    'selection': [
+                                                  ('set', 'Set'),
+                                                  ('remove', 'Remove')
+                                                 ]
+                                  }
+                        etree.SubElement(xml_group, 'field', {
+                                          'name': "selection__" + field.name,
+                                          'colspan': '2'
+                                          }
+                                         )
+                        etree.SubElement(xml_group, 'field', {
+                                    'name': field.name,
+                                    'nolabel': '1',
+                                    'attrs': "{'invisible':[('selection__" \
+                                            + field.name + \
+                                            "','=','remove')]}",
+                                    'colspan': '4',
+                                    }
+                             )
+            etree.SubElement(xml_form, 'separator', {
+                                                     'string': '',
+                                                     'colspan': '6',
+                                                     'col': '6'
+                                                    }
+                             )
             xml_group3 = etree.SubElement(xml_form, 'footer', {})
-            etree.SubElement(xml_group3, 'button', {'string' :'Close', 'icon': "gtk-close", 'special' :'cancel'})
-            etree.SubElement(xml_group3, 'button', {'string' :'Apply', 'icon': "gtk-execute", 'type' :'object', 'name':"action_apply"})
+            etree.SubElement(xml_group3, 'button', {
+                                                    'string': 'Close',
+                                                    'icon': "gtk-close",
+                                                    'special': 'cancel'
+                                                    }
+                             )
+            etree.SubElement(xml_group3, 'button', {
+                                                    'string': 'Apply',
+                                                    'icon': "gtk-execute",
+                                                    'type': 'object',
+                                                    'name': "action_apply"
+                                                    }
+                             )
             root = xml_form.getroottree()
             result['arch'] = etree.tostring(root)
             result['fields'] = all_fields
@@ -99,10 +305,11 @@ class mass_editing_wizard(models.Model):
 
     @api.model
     def create(self, vals):
-        if self._context.get('active_model') and self._context.get('active_ids'):
+        if self._context.get('active_model') \
+            and self._context.get('active_ids'):
             model_obj = self.env[self._context.get('active_model')]
             values = {}
-            for key , val in vals.items():
+            for key, val in vals.items():
                 if key.startswith('selection_'):
                     split_key = key.split('__', 1)[1]
                     if val == 'set':