Browse Source

[FIX]mass_editing:Fixed Travis and m2m remove all data.

pull/19/head
Vacha Trivedi 7 years ago
parent
commit
69f200e4c3
  1. 7
      mass_editing/wizard/mass_editing_wizard.py

7
mass_editing/wizard/mass_editing_wizard.py

@ -450,16 +450,17 @@ class MassEditingWizard(models.TransientModel):
split_key))]) split_key))])
translation_ids.unlink() translation_ids.unlink()
elif val == 'remove_m2m':
if vals.get(split_key):
elif val in ['remove_m2m', 'remove_m2m_all']:
m2m_list = [] m2m_list = []
if vals.get(split_key):
for m2m_id in vals.get(split_key)[0][2]: for m2m_id in vals.get(split_key)[0][2]:
m2m_list.append((3, m2m_id)) m2m_list.append((3, m2m_id))
if m2m_list: if m2m_list:
values.update({split_key: m2m_list}) values.update({split_key: m2m_list})
else: else:
values.update({split_key: [(5, 0, [])]}) values.update({split_key: [(5, 0, [])]})
elif val in ['remove_o2m', 'remove_m2m_all']:
elif val =='remove_o2m':
# model_fieds will return the particular model # model_fieds will return the particular model
# in order to get the field of the model # in order to get the field of the model
# and its relation. # and its relation.

Loading…
Cancel
Save