Browse Source

Added MAssEditing module compatible to v8

Serpent Consulting Services Pvt. Ltd 10 years ago
commit
dab72c37a9

+ 11 - 0
mass_editing/ChangeLog.txt

@@ -0,0 +1,11 @@
+===============================================================================
+ Version Change Log (mass_editing)
+===============================================================================
+1.3	* March 11,2013 : Serpent Consulting Services
+	* Improved and optimized the code of mass_editing
+
+1.2	* Feb 14,2013 : Serpent Consulting Services
+	* Corrected code as per the review by Community
+
+1.1	* Feb 12,2013 : Serpent Consulting Services
+	* Added the module

+ 26 - 0
mass_editing/__init__.py

@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    This module uses OpenERP, Open Source Management Solution Framework.
+#    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
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+import mass_editing
+import wizard
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

+ 43 - 0
mass_editing/__openerp__.py

@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    This module uses OpenERP, Open Source Management Solution Framework.
+#    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
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+{
+    "name" : "Mass Editing",
+    "version" : "1.3",
+    "author" : "Serpent Consulting Services",
+    "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 OpenERP model. 
+        The video explaining the features and how-to for OpenERP Version 6 is here http://t.co/wukYMx1A
+        The video explaining the features and how-to for OpenERP Version 7 is here : http://www.youtube.com/watch?v=9BH0o74A748&feature=youtu.be 
+        For more details/customization/feedback contact us on contact@serpentcs.com. 
+    """,
+    'depends': ['base'],
+    'data': [
+        "security/ir.model.access.csv",
+        'mass_editing_view.xml',
+    ],
+    'installable': True,
+    'application': True,
+    'auto_install': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 134 - 0
mass_editing/i18n/es.po

@@ -0,0 +1,134 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* mass_editing
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0-20140206-002714\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-14 17:40+0000\n"
+"PO-Revision-Date: 2014-03-24 17:44+0000\n"
+"Last-Translator: Alberto Garcia (Factor Libre) "
+"<alberto.garcia@factorlibre.com>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-05-24 06:46+0000\n"
+"X-Generator: Launchpad (build 17017)\n"
+
+#. module: mass_editing
+#: model:ir.actions.act_window,name:mass_editing.action_mass_object_form
+#: model:ir.ui.menu,name:mass_editing.menu_mass_editing
+#: model:ir.ui.menu,name:mass_editing.menu_mass_object_view
+msgid "Mass Editing"
+msgstr "Edición masiva"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid ""
+"Display a button in the sidebar of related documents to open a composition "
+"wizard"
+msgstr ""
+"Mostrar un botón en el menú contextual de los documentos relacionados para "
+"abrir un asistente de composición"
+
+#. module: mass_editing
+#: model:ir.model,name:mass_editing.model_mass_editing_wizard
+msgid "mass.editing.wizard"
+msgstr "mass.editing.wizard"
+
+#. module: mass_editing
+#: field:mass.object,name:0
+msgid "Name"
+msgstr "Nombre"
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:96
+#, python-format
+msgid "Deletion of the action record failed."
+msgstr "Borrado del registro de la acción fallido"
+
+#. module: mass_editing
+#: view:mass.object:0
+#: field:mass.object,field_ids:0
+msgid "Fields"
+msgstr "Campos"
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:62
+#, python-format
+msgid "Mass Editing (%s)"
+msgstr "Edición Masica (%s)"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Object"
+msgstr "Objeto"
+
+#. module: mass_editing
+#: model:ir.model,name:mass_editing.model_mass_object
+msgid "mass.object"
+msgstr "mass.object"
+
+#. module: mass_editing
+#: field:mass.object,model_ids:0
+msgid "Model List"
+msgstr "Lista de modelos"
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:57
+#: sql_constraint:mass.object:0
+#, python-format
+msgid "Name must be unique!"
+msgstr "¡El nombre debe ser único!"
+
+#. module: mass_editing
+#: field:mass.object,ref_ir_act_window:0
+msgid "Sidebar Action"
+msgstr "Acción del menú contextual"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Remove sidebar button"
+msgstr "Eliminar botón del menú contextual"
+
+#. module: mass_editing
+#: field:mass.object,ref_ir_value:0
+msgid "Sidebar Button"
+msgstr "Botón del menú contextual"
+
+#. module: mass_editing
+#: field:mass.object,model_id:0
+msgid "Model"
+msgstr "Modelo"
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:96
+#, python-format
+msgid "Warning"
+msgstr "Advertencia"
+
+#. module: mass_editing
+#: help:mass.object,ref_ir_act_window:0
+msgid ""
+"Sidebar action to make this template available on records                    "
+"                              of the related document model"
+msgstr ""
+"Acción del menú contextual para hacer esta plantilla disponible en los "
+"registros del modelo de documento relacionado"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Add sidebar button"
+msgstr "Añadir botón al menú contextual"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Advanced"
+msgstr "Avanzado"
+
+#. module: mass_editing
+#: help:mass.object,ref_ir_value:0
+msgid "Sidebar button to open the sidebar action"
+msgstr "Botón del menú contextual para abrir la acción del menú contextual"

+ 130 - 0
mass_editing/i18n/fr.po

@@ -0,0 +1,130 @@
+# French translation for server-env-tools
+# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
+# This file is distributed under the same license as the server-env-tools package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: server-env-tools\n"
+"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
+"POT-Creation-Date: 2014-03-14 17:40+0000\n"
+"PO-Revision-Date: 2014-03-20 17:39+0000\n"
+"Last-Translator: Davin Baragiotta <davin@baragiotta.org>\n"
+"Language-Team: French <fr@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-05-24 06:46+0000\n"
+"X-Generator: Launchpad (build 17017)\n"
+
+#. module: mass_editing
+#: model:ir.actions.act_window,name:mass_editing.action_mass_object_form
+#: model:ir.ui.menu,name:mass_editing.menu_mass_editing
+#: model:ir.ui.menu,name:mass_editing.menu_mass_object_view
+msgid "Mass Editing"
+msgstr "Édition en lot"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid ""
+"Display a button in the sidebar of related documents to open a composition "
+"wizard"
+msgstr ""
+
+#. module: mass_editing
+#: model:ir.model,name:mass_editing.model_mass_editing_wizard
+msgid "mass.editing.wizard"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,name:0
+msgid "Name"
+msgstr "Nom"
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:96
+#, python-format
+msgid "Deletion of the action record failed."
+msgstr "La suppression de l'enregistrement de l'action a échoué."
+
+#. module: mass_editing
+#: view:mass.object:0
+#: field:mass.object,field_ids:0
+msgid "Fields"
+msgstr "Champs"
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:62
+#, python-format
+msgid "Mass Editing (%s)"
+msgstr "Édition en lot (%s)"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Object"
+msgstr "Objet"
+
+#. module: mass_editing
+#: model:ir.model,name:mass_editing.model_mass_object
+msgid "mass.object"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,model_ids:0
+msgid "Model List"
+msgstr ""
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:57
+#: sql_constraint:mass.object:0
+#, python-format
+msgid "Name must be unique!"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,ref_ir_act_window:0
+msgid "Sidebar Action"
+msgstr ""
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Remove sidebar button"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,ref_ir_value:0
+msgid "Sidebar Button"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,model_id:0
+msgid "Model"
+msgstr ""
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:96
+#, python-format
+msgid "Warning"
+msgstr ""
+
+#. module: mass_editing
+#: help:mass.object,ref_ir_act_window:0
+msgid ""
+"Sidebar action to make this template available on records                    "
+"                              of the related document model"
+msgstr ""
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Add sidebar button"
+msgstr ""
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Advanced"
+msgstr ""
+
+#. module: mass_editing
+#: help:mass.object,ref_ir_value:0
+msgid "Sidebar button to open the sidebar action"
+msgstr ""

+ 132 - 0
mass_editing/i18n/fr_CA.po

@@ -0,0 +1,132 @@
+# French (Canada) translation for server-env-tools
+# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
+# This file is distributed under the same license as the server-env-tools package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: server-env-tools\n"
+"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
+"POT-Creation-Date: 2014-03-14 17:40+0000\n"
+"PO-Revision-Date: 2014-03-20 16:49+0000\n"
+"Last-Translator: Davin Baragiotta <davin@baragiotta.org>\n"
+"Language-Team: French (Canada) <fr_CA@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-05-24 06:46+0000\n"
+"X-Generator: Launchpad (build 17017)\n"
+
+#. module: mass_editing
+#: model:ir.actions.act_window,name:mass_editing.action_mass_object_form
+#: model:ir.ui.menu,name:mass_editing.menu_mass_editing
+#: model:ir.ui.menu,name:mass_editing.menu_mass_object_view
+msgid "Mass Editing"
+msgstr "Édition en lot"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid ""
+"Display a button in the sidebar of related documents to open a composition "
+"wizard"
+msgstr ""
+"Afficher un bouton dans le menu latéral des documents associés pour ouvrir "
+"un assistant de rédaction"
+
+#. module: mass_editing
+#: model:ir.model,name:mass_editing.model_mass_editing_wizard
+msgid "mass.editing.wizard"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,name:0
+msgid "Name"
+msgstr "Nom"
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:96
+#, python-format
+msgid "Deletion of the action record failed."
+msgstr "Échec de la suppression de l'enregistrement de l'action"
+
+#. module: mass_editing
+#: view:mass.object:0
+#: field:mass.object,field_ids:0
+msgid "Fields"
+msgstr "Champs"
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:62
+#, python-format
+msgid "Mass Editing (%s)"
+msgstr "Édition en lot (%s)"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Object"
+msgstr "Objet"
+
+#. module: mass_editing
+#: model:ir.model,name:mass_editing.model_mass_object
+msgid "mass.object"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,model_ids:0
+msgid "Model List"
+msgstr ""
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:57
+#: sql_constraint:mass.object:0
+#, python-format
+msgid "Name must be unique!"
+msgstr "Le nom doit être unique!"
+
+#. module: mass_editing
+#: field:mass.object,ref_ir_act_window:0
+msgid "Sidebar Action"
+msgstr "Action du menu latéral"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Remove sidebar button"
+msgstr "Enlever le bouton du menu latéral"
+
+#. module: mass_editing
+#: field:mass.object,ref_ir_value:0
+msgid "Sidebar Button"
+msgstr "Bouton du menu latéral"
+
+#. module: mass_editing
+#: field:mass.object,model_id:0
+msgid "Model"
+msgstr "Modèle"
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:96
+#, python-format
+msgid "Warning"
+msgstr "Avertissement"
+
+#. module: mass_editing
+#: help:mass.object,ref_ir_act_window:0
+msgid ""
+"Sidebar action to make this template available on records                    "
+"                              of the related document model"
+msgstr ""
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Add sidebar button"
+msgstr "Ajouter le bouton du menu latéral"
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Advanced"
+msgstr "Avancé"
+
+#. module: mass_editing
+#: help:mass.object,ref_ir_value:0
+msgid "Sidebar button to open the sidebar action"
+msgstr ""

+ 129 - 0
mass_editing/i18n/mass_editing.pot

@@ -0,0 +1,129 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* mass_editing
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-14 17:40+0000\n"
+"PO-Revision-Date: 2014-03-14 17:40+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: mass_editing
+#: model:ir.actions.act_window,name:mass_editing.action_mass_object_form
+#: model:ir.ui.menu,name:mass_editing.menu_mass_editing
+#: model:ir.ui.menu,name:mass_editing.menu_mass_object_view
+msgid "Mass Editing"
+msgstr ""
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Display a button in the sidebar of related documents to open a composition wizard"
+msgstr ""
+
+#. module: mass_editing
+#: model:_description:0
+#: model:ir.model,name:mass_editing.model_mass_editing_wizard
+msgid "mass.editing.wizard"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,name:0
+msgid "Name"
+msgstr ""
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:114
+#, python-format
+msgid "Deletion of the action record failed."
+msgstr ""
+
+#. module: mass_editing
+#: model:_description:0
+#: model:ir.model,name:mass_editing.model_ir_model_fields
+#: view:mass.object:0
+#: field:mass.object,field_ids:0
+msgid "Fields"
+msgstr ""
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:80
+#, python-format
+msgid "Mass Editing (%s)"
+msgstr ""
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Object"
+msgstr ""
+
+#. module: mass_editing
+#: model:_description:0
+#: model:ir.model,name:mass_editing.model_mass_object
+msgid "mass.object"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,model_ids:0
+msgid "Model List"
+msgstr ""
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:57
+#: sql_constraint:mass.object:0
+#, python-format
+msgid "Name must be unique!"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,ref_ir_act_window:0
+msgid "Sidebar Action"
+msgstr ""
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Remove sidebar button"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,ref_ir_value:0
+msgid "Sidebar Button"
+msgstr ""
+
+#. module: mass_editing
+#: field:mass.object,model_id:0
+msgid "Model"
+msgstr ""
+
+#. module: mass_editing
+#: code:addons/mass_editing/mass_editing.py:114
+#, python-format
+msgid "Warning"
+msgstr ""
+
+#. module: mass_editing
+#: help:mass.object,ref_ir_act_window:0
+msgid "Sidebar action to make this template available on records                                                  of the related document model"
+msgstr ""
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Add sidebar button"
+msgstr ""
+
+#. module: mass_editing
+#: view:mass.object:0
+msgid "Advanced"
+msgstr ""
+
+#. module: mass_editing
+#: help:mass.object,ref_ir_value:0
+msgid "Sidebar button to open the sidebar action"
+msgstr ""
+

+ 130 - 0
mass_editing/mass_editing.py

@@ -0,0 +1,130 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    This module uses OpenERP, Open Source Management Solution Framework.
+#    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
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+from openerp import models, fields, api, tools, _
+from lxml import etree
+
+class ir_model_fields(models.Model):
+    _inherit = 'ir.model.fields'
+
+    @api.v7
+    def search(self, cr, uid, args, offset=0, limit=0, order=None, context=None, count=False):
+        model_domain = []
+        for domain in args:
+            if domain[0] == 'model_id' and domain[2] and type(domain[2]) != list:
+                model_domain += [('model_id', 'in', map(int, domain[2][1:-1].split(',')))]
+            else:
+                model_domain.append(domain)
+        return super(ir_model_fields, self).search(cr, uid, model_domain, offset=offset, limit=limit, order=order, context=context, count=count)
+
+ir_model_fields()
+
+class mass_object(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_list = fields.Char(string='Model List', size=256)
+
+    _sql_constraints = [
+        ('name_uniq', 'unique (name)', _('Name must be unique!')), ]
+
+    @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]
+        model_obj = self.env['ir.model']
+        # active_model_obj = self.env[model_obj.browse(self.model_id.id).model]
+        self.model_ids = [[6, 0, model_ids]]
+        self.model_list = [self.model_ids.id]
+
+    @api.multi
+    def create_action(self):
+        vals = {}
+        action_obj = self.env['ir.actions.act_window']
+        data_obj = self.env['ir.model.data']
+        src_obj = self.model_id.model
+        button_name = _('Mass Editing (%s)') % self.name
+        vals['ref_ir_act_window'] = action_obj.create({
+                 'name': button_name,
+                 'type': 'ir.actions.act_window',
+                 'res_model': 'mass.editing.wizard',
+                 'src_model': src_obj,
+                 'view_type': 'form',
+                 'context': "{'mass_editing_object' : %d}" % (self.id),
+                 'view_mode':'form,tree',
+                 'target': 'new',
+                 '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),
+                })
+        return True
+
+
+    @api.one
+    def unlink_action(self):
+                if self.ref_ir_act_window:
+                    winid = self.ref_ir_act_window.id
+                    self.env['ir.actions.act_window'].search([('id', '=', winid)]).unlink()
+
+                if self.ref_ir_value:
+                    uinid = self.ref_ir_value.id
+                    self.env['ir_values'].search([('id', '=', uinid)]).unlink()
+
+    @api.one
+    def unlink(self):
+        self.unlink_action()
+        return super(mass_object, self).unlink()
+
+    @api.multi
+    def copy(self, default):
+        if default is None:
+            default = {}
+
+        default.update({'name':'', 'field_ids': []})
+        return super(mass_object, self).copy(default)
+
+mass_object()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 76 - 0
mass_editing/mass_editing_view.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+
+        <record model="ir.ui.view" id="view_mass_object_form">
+            <field name="name">mass.object.form</field>
+            <field name="model">mass.object</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Object">
+                    <group>
+                    <field name="name"/>
+                    <field name="model_id"/>
+                    <field name="model_ids" invisible="1"/>
+                    <field name="model_list" invisible="1"/>
+                    </group>
+                    <notebook colspan="4">
+                        <page string="Fields">
+                            <field name="field_ids" colspan="4" nolabel="1"
+                                domain="[('ttype', 'not in', ['refenrence', 'function']), ('model_id', 'in', model_list)]"/>
+                        </page>
+                        <page string="Advance">
+                            <group colspan="2" col="2">
+                                <button name="create_action" string="Add sidebar button" type="object" icon="gtk-execute"
+                                        colspan="2" attrs="{'invisible':[('ref_ir_act_window','!=',False)]}"
+                                        help="Display a button in the sidebar of related documents to open a composition wizard"/>
+                                <field name="ref_ir_act_window" attrs="{'invisible':[('ref_ir_act_window','=',False)]}"/>
+                                <field name="ref_ir_value" attrs="{'invisible':[('ref_ir_act_window','=',False)]}"/>
+                                <button name="unlink_action" string="Remove sidebar button" type="object" icon="gtk-delete"
+                                         attrs="{'invisible':[('ref_ir_act_window','=',False)]}" colspan="2" />
+                            </group>
+                        </page>
+                    </notebook>
+                </form>
+            </field>
+        </record>
+
+        <record model="ir.ui.view" id="view_mass_object_tree">
+            <field name="name">mass.object.tree</field>
+            <field name="model">mass.object</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <tree string="Object">
+                    <field name="name"/>
+                    <field name="model_id"/>
+                </tree>
+            </field>
+        </record>
+
+        <record model="ir.actions.act_window" id="action_mass_object_form">
+            <field name="name">Mass Editing</field>
+            <field name="res_model">mass.object</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="view_id" ref="view_mass_object_tree" />
+        </record>
+
+        <record id="action_mass_object_form_view1" model="ir.actions.act_window.view">
+            <field eval="10" name="sequence"/>
+            <field name="view_mode">tree</field>
+            <field name="view_id" ref="view_mass_object_tree"/>
+            <field name="act_window_id" ref="action_mass_object_form"/>
+        </record>
+        <record id="action_mass_object_form_view2" model="ir.actions.act_window.view">
+            <field eval="20" name="sequence"/>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="view_mass_object_form"/>
+            <field name="act_window_id" ref="action_mass_object_form"/>
+        </record>
+
+        <menuitem id="menu_mass_editing" name="Mass Editing" parent="base.menu_config" sequence="6"/>
+
+        <menuitem id="menu_mass_object_view" action="action_mass_object_form" parent="menu_mass_editing"/>
+
+    </data>
+</openerp>

+ 2 - 0
mass_editing/security/ir.model.access.csv

@@ -0,0 +1,2 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_mass_editing_normal_user","mass.editing.normal.user","model_mass_object","base.group_user",1,0,0,0

BIN
mass_editing/static/src/img/icon.png


+ 24 - 0
mass_editing/wizard/__init__.py

@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    This module uses OpenERP, Open Source Management Solution Framework.
+#    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
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+import mass_editing_wizard
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
mass_editing/wizard/__init__.pyc


+ 132 - 0
mass_editing/wizard/mass_editing_wizard.py

@@ -0,0 +1,132 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    This module uses OpenERP, Open Source Management Solution Framework.
+#    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
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+from openerp import models,fields,api,tools,_
+from lxml import etree
+
+
+class mass_editing_wizard(models.Model):
+    _name = 'mass.editing.wizard'
+
+    @api.model
+    def fields_view_get(self,view_type='form',view_id=None):
+      result = super(mass_editing_wizard,self).fields_view_get(view_type,view_id)
+    
+      if self._context.get('mass_editing_object'):
+            mass_object = self.env['mass.object'] 
+            editing_data = mass_object.browse(self._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'})
+            model_obj = self.env[self._context.get('active_model')]
+            field_info = model_obj.fields_get([])
+  
+            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}
+                    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}
+                    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')]}"})
+                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'})
+                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']}
+                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')]}
+                    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')]}"})
+                    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'})
+            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"})
+            root = xml_form.getroottree()
+            result['arch'] = etree.tostring(root)
+            result['fields'] = all_fields
+      return result
+    
+    @api.model
+    def create(self,vals):
+        if self._context.get('active_model') and self._context.get('active_ids'):
+            model_obj = self.env[self._context.get('active_model')]
+            dict = {}
+            for key ,val in vals.items():
+                
+                if key.startswith('selection_'):
+                    split_key= key.split('__',1)[1]
+                    if val == 'set':
+                        dict.update({split_key: vals.get(split_key, False)})
+                        print dict
+                    elif val == 'remove':
+                        dict.update({split_key: False})
+                    elif val == 'remove_m2m':
+                        dict.update({split_key: [(5,0,[])]})
+                    elif val == 'add':
+                        m2m_list = []
+                        for m2m_id in vals.get(split_key, False)[0][2]:
+                            m2m_list.append((4, m2m_id))
+                        dict.update({split_key: m2m_list})
+            if dict:
+               model_obj.browse(self._context.get('active_ids')).write(dict)
+        result = super(mass_editing_wizard, self).create({})
+        return result
+
+    @api.v7
+    def action_apply(self, cr, uid, ids, context=None):
+        return  {'type': 'ir.actions.act_window_close'}
+
+mass_editing_wizard()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
mass_editing/wizard/mass_editing_wizard.pyc