[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) <nle@odoo.com>
Signed-off-by: Youssef Bashandy (yoba) <yoba@odoo.com>
This commit is contained in:
Youssef Bashandy
2023-11-02 12:03:49 +00:00
parent af9343b521
commit 3e0ab80368
+1 -1
View File
@@ -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'],
)