[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
This commit is contained in:
Nicolas Lempereur
2017-05-17 10:39:59 +02:00
parent 878fbc75ff
commit 533f03fe7f
+2 -1
View File
@@ -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