From df683ec13d0b1f154abe59f7e012267d0aed4a26 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Thu, 30 Mar 2017 14:12:46 +0200 Subject: [PATCH] [FIX][mass_editing] Remove view mode space This resulted in frontend searching for ` tree` view, which of course does not exist. --- mass_editing/models/mass_object.py | 2 +- mass_editing/tests/test_mass_editing.py | 4 ++++ mass_editing/wizard/mass_editing_wizard.py | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mass_editing/models/mass_object.py b/mass_editing/models/mass_object.py index 0318a06..ec5a747 100644 --- a/mass_editing/models/mass_object.py +++ b/mass_editing/models/mass_object.py @@ -63,7 +63,7 @@ class MassObject(models.Model): 'src_model': src_obj, 'view_type': 'form', 'context': "{'mass_editing_object' : %d}" % (self.id), - 'view_mode': 'form, tree', + 'view_mode': 'form,tree', 'target': 'new', 'auto_refresh': 1, }).id diff --git a/mass_editing/tests/test_mass_editing.py b/mass_editing/tests/test_mass_editing.py index 0077b27..fb89fbd 100644 --- a/mass_editing/tests/test_mass_editing.py +++ b/mass_editing/tests/test_mass_editing.py @@ -78,6 +78,10 @@ class TestMassEditing(common.TransactionCase): result = self.mass_wiz_obj.with_context(ctx).fields_view_get() self.assertTrue(result.get('arch'), 'Fields view get must return architecture.') + fields = result.get("fields") + self.assertTrue(fields) + for name, values in fields.items(): + self.assertTrue(isinstance(values["views"], dict)) def test_onchange_model(self): """Test whether onchange model_id returns model_id in list""" diff --git a/mass_editing/wizard/mass_editing_wizard.py b/mass_editing/wizard/mass_editing_wizard.py index 5b6ea2c..17dc3f5 100644 --- a/mass_editing/wizard/mass_editing_wizard.py +++ b/mass_editing/wizard/mass_editing_wizard.py @@ -207,6 +207,9 @@ class MassEditingWizard(models.TransientModel): field.name + "','=','remove')]}"), 'colspan': '4', }) + # Patch fields with required extra data + for field in all_fields.values(): + field.setdefault("views", {}) etree.SubElement(xml_form, 'separator', { 'string': '', 'colspan': '6',