From bef898e1eab320783585ffa302950ea38cca867b Mon Sep 17 00:00:00 2001 From: Jinjiu Liu Date: Tue, 8 Feb 2022 16:04:51 +0000 Subject: [PATCH] [FIX] event_sale: Added a domain condition on attendee_count in SO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reproduction: 1. Start the process to buy (register) 2 tickets for an event 2. Go back to “review order” and reduce the quantity to 1 3. Sign up with a new portal user and create an account 4. Change the number of tickets to 2 Reason: the seats_expected in event.event has a different computation logic from the attendee_count in sale.order. In event.event, the seats_expected does not count canceled registrations. In sale.order, the attendee_count counts the canceled registrations. But they are both shown as "Attendees" in the statinfo widget of form views Fix: Added a domain condition to filter out canceled registrations when computing attendee_count in SO opw-2739310 closes odoo/odoo#85491 X-original-commit: 88fecdc4966dfba2a3f65bc2a8f139e7ee025d15 Signed-off-by: Thibault Delavallee (tde) --- addons/event_sale/models/sale_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/event_sale/models/sale_order.py b/addons/event_sale/models/sale_order.py index a1cbff67c77..3919ae41b16 100644 --- a/addons/event_sale/models/sale_order.py +++ b/addons/event_sale/models/sale_order.py @@ -40,7 +40,8 @@ class SaleOrder(models.Model): def _compute_attendee_count(self): sale_orders_data = self.env['event.registration'].read_group( - [('sale_order_id', 'in', self.ids)], + [('sale_order_id', 'in', self.ids), + ('state', '!=', 'cancel')], ['sale_order_id'], ['sale_order_id'] ) attendee_count_data = {