From 099f5936212c1f0739f5112560bc10039a96570f Mon Sep 17 00:00:00 2001 From: Serpent Consulting Services Date: Fri, 15 Feb 2013 02:01:22 +0530 Subject: [PATCH] [IMP] mass_editing : Improved typos and did some refactoring --- mass_editing/__openerp__.py | 3 +- mass_editing/mass_editing.py | 47 ++++++++++---------- mass_editing/mass_editing_view.xml | 4 +- mass_editing/wizard/mass_editing_wizard.py | 50 +++++++++++----------- 4 files changed, 49 insertions(+), 55 deletions(-) diff --git a/mass_editing/__openerp__.py b/mass_editing/__openerp__.py index 716780b36..fdf54783a 100644 --- a/mass_editing/__openerp__.py +++ b/mass_editing/__openerp__.py @@ -31,8 +31,7 @@ For more details/customization/feedback contact us on contact@serpentcs.com. """, 'depends': ['base'], - 'init_xml': [], - 'update_xml': [ + 'data': [ 'mass_editing_view.xml', ], 'installable': True, diff --git a/mass_editing/mass_editing.py b/mass_editing/mass_editing.py index a054c7686..145272b21 100644 --- a/mass_editing/mass_editing.py +++ b/mass_editing/mass_editing.py @@ -40,14 +40,14 @@ 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, + '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"), + "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) } @@ -65,9 +65,6 @@ class mass_object(osv.osv): if model_ids: model_list += "," + str(model_ids[0]) + "" model_list += "]" -# model_list = map(int, model_list[1:-1].split(',')) -# context['model_list'] = model_list -# print 'context:::', context return {'value': {'model_list': model_list}} def create_action(self, cr, uid, ids, context=None): @@ -78,26 +75,26 @@ class mass_object(osv.osv): 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', + '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, + '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), + 'ref_ir_act_window': vals.get('ref_ir_act_window', False), + 'ref_ir_value': vals.get('ref_ir_value', False), }, context) return True diff --git a/mass_editing/mass_editing_view.xml b/mass_editing/mass_editing_view.xml index c26e5750c..c304b810a 100644 --- a/mass_editing/mass_editing_view.xml +++ b/mass_editing/mass_editing_view.xml @@ -14,9 +14,9 @@ + domain="[('ttype', 'not in', ['one2many', 'reference', 'function']), ('model_id', 'in', model_list)]"/> - +