From 41bd821f82c4b7e6a56df284a1ec26165eeeddcd Mon Sep 17 00:00:00 2001 From: "Eteil Djoumatchoua(etdj)" Date: Mon, 9 Oct 2023 13:41:00 +0200 Subject: [PATCH] [FIX] event_sale: get the right number of registrations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps: - Create a new event. - Choose any template (training, conference,...). - Create new registration ticket for this event. - Create a new quotation. - Add 2 lines for "Event registration" product, and select each time the event and ticket created above. - Click on "Confirm". Issue: 4 registrations lines are created and 3 attendees. Reason: In ``RegistrationEditor.default_get()``, we match each sale order line with existing registrations in the sale order having the same ``event_ticket_id`` without assuming we can have multiple sale order lines with the same ``event_ticket_id``. That leads to [number_of_sol] * [number_of_ticket] registrations. To solve it, we just add an additional check for the ``sale_order_line_id`` to have a perfect match. opw-3495415 closes odoo/odoo#138242 X-original-commit: 926ab300650eda02aefa728fa32b44831c49dfb3 Signed-off-by: Jérémy Hennecart (jeh) --- addons/event_sale/wizard/event_edit_registration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/event_sale/wizard/event_edit_registration.py b/addons/event_sale/wizard/event_edit_registration.py index 13b55fdece4..215bdda9d18 100644 --- a/addons/event_sale/wizard/event_edit_registration.py +++ b/addons/event_sale/wizard/event_edit_registration.py @@ -58,7 +58,7 @@ class RegistrationEditor(models.TransientModel): attendee_list = [] for so_line in [l for l in sale_order.order_line if l.event_ticket_id]: - existing_registrations = [r for r in registrations if r.event_ticket_id == so_line.event_ticket_id] + existing_registrations = [r for r in registrations if r.event_ticket_id == so_line.event_ticket_id and r.sale_order_line_id == so_line] for reg in existing_registrations: attendee_list.append([0, 0, { 'event_id': reg.event_id.id,