← Back to team overview

openerp-community team mailing list archive

[Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

 

Maxime Chambreuil (http://www.savoirfairelinux.com) has proposed merging lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1.

Requested reviews:
  Server Environment And Tools Core Editors (server-env-tools-core-editors)

For more details, see:
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
-- 
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.
=== added directory 'mass_editing'
=== added file 'mass_editing/__init__.py'
--- mass_editing/__init__.py	1970-01-01 00:00:00 +0000
+++ mass_editing/__init__.py	2013-04-30 14:51:30 +0000
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012 Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.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:
+

=== added file 'mass_editing/__openerp__.py'
--- mass_editing/__openerp__.py	1970-01-01 00:00:00 +0000
+++ mass_editing/__openerp__.py	2013-04-30 14:51:30 +0000
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012 Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.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.1",
+    "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 is available at http://t.co/wukYMx1A
+        The menu is now Under Settings/Configuration.
+        For more details/customization/feedback contact us on contact@xxxxxxxxxxxxx. 
+    """,
+    'depends': ['base'],
+    'init_xml': [],
+    'update_xml': [
+        "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:

=== added file 'mass_editing/mass_editing.py'
--- mass_editing/mass_editing.py	1970-01-01 00:00:00 +0000
+++ mass_editing/mass_editing.py	2013-04-30 14:51:30 +0000
@@ -0,0 +1,102 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012 Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.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 osv import fields, osv
+from tools.translate import _
+
+class mass_object(osv.osv):
+    _name = "mass.object"
+
+    _columns = {
+        'name' : fields.char("Name", size=64, required=True, select=1),
+        'model_id' : fields.many2one('ir.model', 'Model', required=True, select=1),
+        'field_ids' : fields.many2many('ir.model.fields', 'mass_field_rel', 'mass_id', 'field_id', 'Fields'),
+        'ref_ir_act_window':fields.many2one('ir.actions.act_window', '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', 'Sidebar button', readonly=True,
+                                       help="Sidebar button to open the sidebar action"),
+        'model_list': fields.char('Model List', size=256)
+    }
+
+    def onchange_model(self, cr, uid, ids, model_id):
+        model_list = ""
+        if model_id:
+            model_obj = self.pool.get('ir.model')
+            model_data = model_obj.browse(cr, uid, model_id)
+            model_list = "[" + str(model_id) + ""
+            active_model_obj = self.pool.get(model_data.model)
+            if active_model_obj._inherits:
+                for key, val in active_model_obj._inherits.items():
+                    model_ids = model_obj.search(cr, uid, [('model', '=', key)])
+                    if model_ids:
+                        model_list += "," + str(model_ids[0]) + ""
+            model_list += "]"
+        return {'value': {'model_list': model_list}}
+
+    def create_action(self, cr, uid, ids, context=None):
+        vals = {}
+        action_obj = self.pool.get('ir.actions.act_window')
+        data_obj = self.pool.get('ir.model.data')
+        for data in self.browse(cr, uid, ids, context=context):
+            src_obj = data.model_id.model
+            button_name = _('Mass Editing (%s)') % data.name
+            vals['ref_ir_act_window'] = action_obj.create(cr, uid, {
+                 '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}" % (data.id),
+                 'view_mode':'form,tree',
+                 'target': 'new',
+                 'auto_refresh':1
+            }, context)
+            vals['ref_ir_value'] = self.pool.get('ir.values').create(cr, uid, {
+                 'name': button_name,
+                 'model': src_obj,
+                 'key2': 'client_action_multi',
+                 'value': "ir.actions.act_window," + str(vals['ref_ir_act_window']),
+                 'object': True,
+             }, context)
+        self.write(cr, uid, ids, {
+                    'ref_ir_act_window': vals.get('ref_ir_act_window',False),
+                    'ref_ir_value': vals.get('ref_ir_value',False),
+                }, context)
+        return True
+
+    def unlink_action(self, cr, uid, ids, context=None):
+        for template in self.browse(cr, uid, ids, context=context):
+            try:
+                if template.ref_ir_act_window:
+                    self.pool.get('ir.actions.act_window').unlink(cr, uid, template.ref_ir_act_window.id, context)
+                if template.ref_ir_value:
+                    ir_values_obj = self.pool.get('ir.values')
+                    ir_values_obj.unlink(cr, uid, template.ref_ir_value.id, context)
+            except:
+                raise osv.except_osv(_("Warning"), _("Deletion of the action record failed."))
+        return True
+
+mass_object()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'mass_editing/mass_editing_view.xml'
--- mass_editing/mass_editing_view.xml	1970-01-01 00:00:00 +0000
+++ mass_editing/mass_editing_view.xml	2013-04-30 14:51:30 +0000
@@ -0,0 +1,73 @@
+<?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">
+                    <field name="name"/>
+                    <field name="model_id" on_change="onchange_model(model_id)"/>
+                    <field name="model_list" invisible="1"/>
+                    <notebook colspan="4">
+                        <page string="Fields">
+                            <field name="field_ids" colspan="4" nolabel="1"
+                                domain="[('ttype', 'not in', ['one2many', 'refenrence', 'function']), ('model_id', 'in', eval(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>

=== added directory 'mass_editing/security'
=== added file 'mass_editing/security/ir.model.access.csv'
--- mass_editing/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ mass_editing/security/ir.model.access.csv	2013-04-30 14:51:30 +0000
@@ -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,1,1,0

=== added directory 'mass_editing/wizard'
=== added file 'mass_editing/wizard/__init__.py'
--- mass_editing/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ mass_editing/wizard/__init__.py	2013-04-30 14:51:30 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012 Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.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:
\ No newline at end of file

=== added file 'mass_editing/wizard/mass_editing_wizard.py'
--- mass_editing/wizard/mass_editing_wizard.py	1970-01-01 00:00:00 +0000
+++ mass_editing/wizard/mass_editing_wizard.py	2013-04-30 14:51:30 +0000
@@ -0,0 +1,133 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012 Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.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 osv import osv
+from osv import fields
+from lxml import etree
+import tools
+
+class mass_editing_wizard(osv.osv_memory):
+    _name = 'mass.editing.wizard'
+
+    _columns = {
+        'serpent_image': fields.binary('Image'),
+    }
+
+    _defaults = {
+        'serpent_image': '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',
+    }
+
+    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+        result = super(mass_editing_wizard, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
+        if context.get('mass_editing_object'):
+            mass_object = self.pool.get('mass.object') 
+            editing_data = mass_object.browse(cr, uid, context.get('mass_editing_object'), context)
+            all_fields = {}
+            xml_form = etree.Element('form', {'string': tools.ustr(editing_data.name)})
+            xml_group = etree.SubElement(xml_form, 'group', {'colspan': '4'})
+            etree.SubElement(xml_group, 'field', {'name': 'serpent_image', 'nolabel': '1','colspan': '1', 'modifiers': '{"readonly": true}', 'widget':'image'})
+            etree.SubElement(xml_group, 'label', {'string': '','colspan': '2'})
+            all_fields['serpent_image'] = {'type':'binary', 'string':''}
+            xml_group = etree.SubElement(xml_form, 'group', {'colspan': '4'})
+            model_obj = self.pool.get(context.get('active_model'))
+            for field in editing_data.field_ids:
+                if field.ttype == "many2many":
+                    field_info = model_obj.fields_get(cr, uid, [field.name], context)
+                    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 == "many2one":
+                    field_info = model_obj.fields_get(cr, uid, [field.name], context)
+                    if field_info:
+                        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":
+                    field_info = model_obj.fields_get(cr, uid, [field.name], context)
+                    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':
+                    field_info = model_obj.fields_get(cr, uid, [field.name], context)
+                    all_fields["selection_"+field.name] = {'type':'selection', 'string': field_info[field.name]['string'],'selection':[('set','Set'),('remove','Remove')]}
+                    field_info = model_obj.fields_get(cr, uid, [field.name], context)
+                    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:
+                    field_info = model_obj.fields_get(cr, uid, [field.name], context)
+                    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': '6'})
+            xml_group3 = etree.SubElement(xml_form, 'group', {'col': '2', 'colspan': '4'})
+            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
+
+    def create(self, cr, uid, vals, context=None):
+        if context.get('active_model') and context.get('active_ids'):
+            model_obj = self.pool.get(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)})
+                    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.write(cr, uid, context.get('active_ids'), dict, context)
+        result = super(mass_editing_wizard, self).create(cr, uid, {}, context)
+        return result
+
+    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:


Follow ups