From 533f03fe7f86d7414c53d4f411ba3d88a308e887 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 17 May 2017 10:04:13 +0200 Subject: [PATCH] [FIX] event_sale: auto_confirm free ticket After 5d4dd98a a registration was confirmed once an invoice was fully paid. This is not very handy if the registration was free to begin with, you need to create a 0.00 amount invoice. This commit get back the previous behavior of auto-confirming regitration directly when the registration is free. opw-742901 closes #17035 --- 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 ec9bbe2ffae..44801880267 100644 --- a/addons/event_sale/models/sale_order.py +++ b/addons/event_sale/models/sale_order.py @@ -10,7 +10,8 @@ class SaleOrder(models.Model): def action_confirm(self): self.ensure_one() res = super(SaleOrder, self).action_confirm() - self.order_line._update_registrations(confirm=False, cancel_to_draft=False) + # confirm registration if it was free (otherwise it will be confirmed once invoice fully paid) + self.order_line._update_registrations(confirm=self.amount_total == 0, cancel_to_draft=False) if any(self.order_line.filtered(lambda line: line.event_id)): return self.env['ir.actions.act_window'].with_context(default_sale_order_id=self.id).for_xml_id('event_sale', 'action_sale_order_event_registration') return res