From 36c5b0b1a2a714327c21e7108b23d106c3414cd7 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 26 Oct 2023 11:25:12 +0200 Subject: [PATCH] [FIX] partner_event: recover missing functionality In previous versions it was possible to use the registration wizard from the attendees list. This commit recovers it. TT45692 --- partner_event/wizard/res_partner_register_event.py | 13 ++++++++++--- .../wizard/res_partner_register_event_view.xml | 8 ++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/partner_event/wizard/res_partner_register_event.py b/partner_event/wizard/res_partner_register_event.py index 536c7b764..ebae3d0e5 100644 --- a/partner_event/wizard/res_partner_register_event.py +++ b/partner_event/wizard/res_partner_register_event.py @@ -31,9 +31,16 @@ def _prepare_registration(self, partner): def button_register(self): vals_list = [] Registration = self.env["event.registration"] - for partner in self.env["res.partner"].browse( - self.env.context.get("active_ids", []) - ): + active_ids = self.env.context.get("active_ids", []) + if self.env.context.get("active_model", "") == "event.registration": + partners = ( + self.env["event.registration"] + .browse(active_ids) + .mapped("attendee_partner_id") + ) + else: + partners = self.env["res.partner"].browse(active_ids) + for partner in partners: if not Registration.search( [ ("event_id", "=", self.event.id), diff --git a/partner_event/wizard/res_partner_register_event_view.xml b/partner_event/wizard/res_partner_register_event_view.xml index c1846c61f..fe0128a25 100644 --- a/partner_event/wizard/res_partner_register_event_view.xml +++ b/partner_event/wizard/res_partner_register_event_view.xml @@ -37,4 +37,12 @@ new + + Register in an event + res.partner.register.event + form + + + new +