Browse Source

[IMP] Don't use a reserved word for a variable name

pull/78/head
Stefan Rijnhart 11 years ago
parent
commit
d5e9b4e83e
  1. 14
      mass_editing/wizard/mass_editing_wizard.py

14
mass_editing/wizard/mass_editing_wizard.py

@ -98,26 +98,26 @@ class mass_editing_wizard(osv.osv_memory):
def create(self, cr, uid, vals, context=None): def create(self, cr, uid, vals, context=None):
if context.get('active_model') and context.get('active_ids'): if context.get('active_model') and context.get('active_ids'):
model_obj = self.pool.get(context.get('active_model')) model_obj = self.pool.get(context.get('active_model'))
dict = {}
model_vals = {}
for key ,val in vals.items(): for key ,val in vals.items():
if key.startswith('selection_'): if key.startswith('selection_'):
split_key= key.split('_',1)[1] split_key= key.split('_',1)[1]
if val == 'set': if val == 'set':
dict.update({split_key: vals.get(split_key, False)})
model_vals.update({split_key: vals.get(split_key, False)})
elif val == 'remove': elif val == 'remove':
dict.update({split_key: False})
model_vals.update({split_key: False})
elif val == 'remove_m2m': elif val == 'remove_m2m':
m2m_list = [] m2m_list = []
for m2m_id in vals.get(split_key, False)[0][2]: for m2m_id in vals.get(split_key, False)[0][2]:
m2m_list.append((3, m2m_id)) m2m_list.append((3, m2m_id))
dict.update({split_key: m2m_list})
model_vals.update({split_key: m2m_list})
elif val == 'add': elif val == 'add':
m2m_list = [] m2m_list = []
for m2m_id in vals.get(split_key, False)[0][2]: for m2m_id in vals.get(split_key, False)[0][2]:
m2m_list.append((4, m2m_id)) 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)
model_vals.update({split_key: m2m_list})
if model_vals:
model_obj.write(cr, uid, context.get('active_ids'), model_vals, context)
result = super(mass_editing_wizard, self).create(cr, uid, {}, context) result = super(mass_editing_wizard, self).create(cr, uid, {}, context)
return result return result

Loading…
Cancel
Save