Skip to content

Commit

Permalink
Merge pull request #32 from avanzosc/8.0-mass_editing
Browse files Browse the repository at this point in the history
[ADD] Migrated <mass_editing> for Odoo
  • Loading branch information
pedrobaeza committed Aug 4, 2014
2 parents 9a06383 + 9e24c6f commit 4765f54
Show file tree
Hide file tree
Showing 15 changed files with 216 additions and 149 deletions.
71 changes: 0 additions & 71 deletions __unported__/mass_editing/mass_editing_view.xml

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
# 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
Expand All @@ -19,6 +20,5 @@
#
##############################################################################

import mass_editing_wizard

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from . import models
from . import wizard
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,28 @@
"name": "Mass Editing",
"version": "1.3",
"author": "Serpent Consulting Services",
"contributors": [
"Oihane Crucelaegui <oihanecrucelaegi@gmail.com>",
],
"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.
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.
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',
'views/mass_editing_view.xml',
],
'installable': False,
'installable': True,
'application': True,
'auto_install': False,
}

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ msgstr "Campos"
#: code:addons/mass_editing/mass_editing.py:62
#, python-format
msgid "Mass Editing (%s)"
msgstr "Edición Masica (%s)"
msgstr "Edición Masiva (%s)"

#. module: mass_editing
#: view:mass.object:0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,8 +20,5 @@
#
##############################################################################

import mass_editing
import wizard

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

from . import ir_model_fields
from . import mass_object
42 changes: 42 additions & 0 deletions mass_editing/models/ir_model_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- 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.osv import orm


class IrModelFields(orm.Model):
_inherit = 'ir.model.fields'

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(IrModelFields, self).search(
cr, uid, model_domain, offset=offset, limit=limit, order=order,
context=context, count=count)
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,12 @@
#
##############################################################################

from openerp.osv import orm, fields, osv
from openerp import SUPERUSER_ID
from openerp.osv import orm, fields
from openerp.tools.translate import _


class ir_model_fields(orm.Model):
_inherit = 'ir.model.fields'

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(orm.Model):
class MassObject(orm.Model):
_name = "mass.object"

_columns = {
Expand Down Expand Up @@ -75,7 +55,7 @@ def onchange_model(self, cr, uid, ids, model_id, context=None):
if not model_id:
return {'value': {'model_ids': [(6, 0, [])]}}
model_ids = [model_id]
model_obj = self.pool.get('ir.model')
model_obj = self.pool['ir.model']
active_model_obj = self.pool.get(model_obj.browse(
cr, uid, model_id).model)
if active_model_obj._inherits:
Expand All @@ -87,12 +67,12 @@ def onchange_model(self, cr, uid, ids, model_id, context=None):

def create_action(self, cr, uid, ids, context=None):
vals = {}
action_obj = self.pool.get('ir.actions.act_window')
ir_values_obj = self.pool.get('ir.values')
action_obj = self.pool['ir.actions.act_window']
ir_values_obj = self.pool['ir.values']
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, {
vals['ref_ir_act_window'] = action_obj.create(cr, SUPERUSER_ID, {
'name': button_name,
'type': 'ir.actions.act_window',
'res_model': 'mass.editing.wizard',
Expand All @@ -103,7 +83,7 @@ def create_action(self, cr, uid, ids, context=None):
'target': 'new',
'auto_refresh': 1,
}, context)
vals['ref_ir_value'] = ir_values_obj.create(cr, uid, {
vals['ref_ir_value'] = ir_values_obj.create(cr, SUPERUSER_ID, {
'name': button_name,
'model': src_obj,
'key2': 'client_action_multi',
Expand All @@ -122,28 +102,28 @@ 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)
act_window_obj = self.pool['ir.actions.act_window']
act_window_obj.unlink(
cr, SUPERUSER_ID, [template.ref_ir_act_window.id],
context=context)
if template.ref_ir_value:
ir_values_obj = self.pool.get('ir.values')
ir_values_obj = self.pool['ir.values']
ir_values_obj.unlink(
cr, uid, template.ref_ir_value.id, context)
cr, SUPERUSER_ID, template.ref_ir_value.id,
context=context)
except:
raise osv.except_osv(
raise orm.except_orm(
_("Warning"),
_("Deletion of the action record failed."))
return True

def unlink(self, cr, uid, ids, context=None):
self.unlink_action(cr, uid, ids, context)
return super(mass_object, self).unlink(cr, uid, ids, context)
self.unlink_action(cr, uid, ids, context=context)
return super(MassObject, self).unlink(cr, uid, ids, context=context)

def copy(self, cr, uid, record_id, default=None, context=None):
if default is None:
default = {}
default.update({'name': '', 'field_ids': []})
return super(mass_object, self).copy(
cr, uid, record_id, default, context)

mass_object()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
return super(MassObject, self).copy(
cr, uid, record_id, default, context=context)
File renamed without changes.
Loading

0 comments on commit 4765f54

Please sign in to comment.