From 3e0ab80368cdded364982932dcdf02e27c8aa67a Mon Sep 17 00:00:00 2001 From: Youssef Bashandy Date: Tue, 24 Oct 2023 13:29:56 +0000 Subject: [PATCH] [FIX] event_sale : Incorrect event sales value upon cancelling Steps to reproduce: 1- Install Sales and Events modules 2- Create a new Event and event registeration 3- Create a sale order for this event 4- Check the sales smart button in the event's form 5- Cancel the sale order and check the smart button Current behavior before PR: When you create a sale order for an event and then cancel it the value of this sale order will not be deducted from the sum of the sale values at the sale smart button in the event form. Desired behavior after PR is merged: When you cancel a sale order related to an event the sale smart button value will be updated opw-3543943 closes odoo/odoo#140547 X-original-commit: b5554f6f7597b44adfa318655bab1eab19158303 Signed-off-by: Nicolas Lempereur (nle) Signed-off-by: Youssef Bashandy (yoba) --- addons/event_sale/models/event_event.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/event_sale/models/event_event.py b/addons/event_sale/models/event_event.py index 4ab99bbe0ab..c6950241930 100644 --- a/addons/event_sale/models/event_event.py +++ b/addons/event_sale/models/event_event.py @@ -32,7 +32,7 @@ class Event(models.Model): we sell a single event ticket). """ date_now = fields.Datetime.now() event_subtotals = self.env['sale.order.line']._read_group( - [('event_id', 'in', self.ids), ('price_subtotal', '!=', 0)], + [('event_id', 'in', self.ids), ('price_subtotal', '!=', 0), ('state', '!=', 'cancel')], ['event_id', 'currency_id'], ['price_subtotal:sum'], )