diff --git a/mass_editing/__openerp__.py b/mass_editing/__openerp__.py index 3be5587..ef373da 100644 --- a/mass_editing/__openerp__.py +++ b/mass_editing/__openerp__.py @@ -28,6 +28,7 @@ ], "category": "Tools", "website": "http://www.serpentcs.com", + "license": "GPL-3 or any later version", "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. diff --git a/mass_editing/models/ir_model_fields.py b/mass_editing/models/ir_model_fields.py index d75e7f6..b1413fe 100644 --- a/mass_editing/models/ir_model_fields.py +++ b/mass_editing/models/ir_model_fields.py @@ -31,8 +31,9 @@ class IrModelFields(orm.Model): count=False): model_domain = [] for domain in args: - if (len(domain) > 2 and domain[0] == 'model_id' - and isinstance(domain[2], basestring)): + if (len(domain) > 2 and + domain[0] == 'model_id' and + isinstance(domain[2], basestring)): model_domain += [ ('model_id', 'in', map(int, domain[2][1:-1].split(','))) ] diff --git a/mass_editing/models/mass_object.py b/mass_editing/models/mass_object.py index 8e7737d..d859ea7 100644 --- a/mass_editing/models/mass_object.py +++ b/mass_editing/models/mass_object.py @@ -49,7 +49,7 @@ class MassObject(orm.Model): ('name_uniq', 'unique (name)', _('Name must be unique!')), ] - def onchange_model(self, cr, uid, ids, model_id, context=None): + def onchange_model_id(self, cr, uid, ids, model_id, context=None): if context is None: context = {} if not model_id: @@ -72,30 +72,39 @@ class MassObject(orm.Model): 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, SUPERUSER_ID, { - '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'] = ir_values_obj.create(cr, SUPERUSER_ID, { - '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) + vals['ref_ir_act_window'] = action_obj.create( + cr, SUPERUSER_ID, + { + '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'] = ir_values_obj.create( + cr, SUPERUSER_ID, + { + '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): diff --git a/mass_editing/security/ir.model.access.csv b/mass_editing/security/ir.model.access.csv index 80ee747..95b6421 100755 --- a/mass_editing/security/ir.model.access.csv +++ b/mass_editing/security/ir.model.access.csv @@ -1,2 +1,3 @@ -"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 +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 +access_mass_editing_normal_erp_manager,mass.editing.normal.erp_manager,model_mass_object,base.group_erp_manager,1,1,1,1 diff --git a/mass_editing/wizard/mass_editing_wizard.py b/mass_editing/wizard/mass_editing_wizard.py index 4af12c3..b266d34 100644 --- a/mass_editing/wizard/mass_editing_wizard.py +++ b/mass_editing/wizard/mass_editing_wizard.py @@ -67,8 +67,8 @@ class MassEditingWizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'colspan': '4', 'nolabel': '1', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove_m2m')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove_m2m')]}")}) elif field.ttype == "one2many": all_fields["selection__" + field.name] = { 'type': 'selection', @@ -82,8 +82,8 @@ class MassEditingWizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'colspan': '4', 'nolabel': '1', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove_o2m')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove_o2m')]}")}) elif field.ttype == "many2one": all_fields["selection__" + field.name] = { 'type': 'selection', @@ -97,8 +97,8 @@ class MassEditingWizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'nolabel': '1', 'colspan': '2', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove')]}")}) elif field.ttype == "char": all_fields["selection__" + field.name] = { 'type': 'selection', @@ -110,12 +110,12 @@ class MassEditingWizard(orm.TransientModel): 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')]}"), + "{'invisible':[('selection__" + + field.name + "','=','remove')]}"), 'colspan': '2'}) elif field.ttype == 'selection': all_fields["selection__" + field.name] = { @@ -127,8 +127,8 @@ class MassEditingWizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'nolabel': '1', 'colspan': '2', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove')]}")}) all_fields[field.name] = { 'type': field.ttype, 'string': field.field_description, @@ -152,8 +152,8 @@ class MassEditingWizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'colspan': '4', 'nolabel': '1', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove')]}")}) else: all_fields["selection__" + field.name] = { 'type': 'selection', @@ -166,8 +166,8 @@ class MassEditingWizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'nolabel': '1', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove')]}"), + "{'invisible':[('selection__" + + field.name + "','=','remove')]}"), 'colspan': '2', }) etree.SubElement( xml_form, 'separator', {'string': '', 'colspan': '4'})