|
@ -200,6 +200,8 @@ class MassEditingWizard(orm.TransientModel): |
|
|
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')) |
|
|
|
|
|
model_field_obj = self.pool.get('ir.model.fields') |
|
|
|
|
|
translation_obj = self.pool.get('ir.translation') |
|
|
dict = {} |
|
|
dict = {} |
|
|
for key, val in vals.items(): |
|
|
for key, val in vals.items(): |
|
|
if key.startswith('selection__'): |
|
|
if key.startswith('selection__'): |
|
@ -208,6 +210,23 @@ class MassEditingWizard(orm.TransientModel): |
|
|
dict.update({split_key: vals.get(split_key, False)}) |
|
|
dict.update({split_key: vals.get(split_key, False)}) |
|
|
elif val == 'remove': |
|
|
elif val == 'remove': |
|
|
dict.update({split_key: False}) |
|
|
dict.update({split_key: False}) |
|
|
|
|
|
# If field to remove is translatable, |
|
|
|
|
|
# its translations have to be removed |
|
|
|
|
|
model_field_id = model_field_obj.search(cr, uid, [ |
|
|
|
|
|
('model', '=', context.get('active_model')), |
|
|
|
|
|
('name', '=', split_key) |
|
|
|
|
|
]) |
|
|
|
|
|
if model_field_id and model_field_obj.browse( |
|
|
|
|
|
cr, uid, model_field_id, |
|
|
|
|
|
context=context).translate: |
|
|
|
|
|
translation_ids = translation_obj.search(cr, uid, [ |
|
|
|
|
|
('res_id', 'in', context.get('active_ids')), |
|
|
|
|
|
('type', '=', 'model'), |
|
|
|
|
|
('name', '=', u"{0},{1}".format( |
|
|
|
|
|
context.get('active_model'), split_key))]) |
|
|
|
|
|
translation_obj.unlink(cr, uid, translation_ids, |
|
|
|
|
|
context=context) |
|
|
|
|
|
|
|
|
elif val == 'remove_m2m': |
|
|
elif val == 'remove_m2m': |
|
|
dict.update({split_key: [ |
|
|
dict.update({split_key: [ |
|
|
(3, id) for id in vals.get( |
|
|
(3, id) for id in vals.get( |
|
|