[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user