From 0ac9fdb41d3bfcc514fcd2194b58bdf7362e7187 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 23 Aug 2023 14:59:33 +0200 Subject: [PATCH] [ADD] server_action_mass_edit: add support for o2m fields --- server_action_mass_edit/demo/mass_editing.xml | 4 ++ .../tests/test_mass_editing.py | 49 +++++++++++++++ .../wizard/mass_editing_wizard.py | 60 +++++++++++++++++-- 3 files changed, 108 insertions(+), 5 deletions(-) diff --git a/server_action_mass_edit/demo/mass_editing.xml b/server_action_mass_edit/demo/mass_editing.xml index 2235e92d28..7587bd2ed8 100644 --- a/server_action_mass_edit/demo/mass_editing.xml +++ b/server_action_mass_edit/demo/mass_editing.xml @@ -53,6 +53,10 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). image + + + + diff --git a/server_action_mass_edit/tests/test_mass_editing.py b/server_action_mass_edit/tests/test_mass_editing.py index d5222b174a..4d12de1263 100644 --- a/server_action_mass_edit/tests/test_mass_editing.py +++ b/server_action_mass_edit/tests/test_mass_editing.py @@ -152,6 +152,25 @@ def test_wiz_fields_view_get(self): "Fields view get must return architecture with fields" "created dynamicaly", ) + # test the code path where we extract an embedded tree for o2m fields + self.env["ir.ui.view"].search( + [ + ("model", "in", ("res.partner.bank", "res.partner", "res.users")), + ("id", "!=", self.env.ref("base.res_partner_view_form_private").id), + ] + ).unlink() + self.env.ref("base.res_partner_view_form_private").model = "res.users" + result = self.MassEditingWizard.with_context( + server_action_id=self.mass_editing_user.id, + active_ids=[], + ).get_view() + arch = result.get("arch", "") + self.assertIn( + "