[FIX] event_sale: fix event registration confirmation modal

Task #1910927

Purpose
=======

When confirming a sale order with event tickets, a modal is supposed to be shown to be able to
confirm the event registration.

That modal was not shown anymore.

To solve it, we split the '_action_confirm' to run the actual business of the event_sale module,
which is '_update_registrations', and moved the action returned in the regular 'action_confirm' method.

closes odoo/odoo#29997
This commit is contained in:
Aurélien Warnon
2019-01-09 08:50:45 +00:00
committed by Nicolas Martinelli
parent cd1d9824ab
commit b654fabe04
+9 -1
View File
@@ -12,8 +12,16 @@ class SaleOrder(models.Model):
for so in self:
# confirm registration if it was free (otherwise it will be confirmed once invoice fully paid)
so.order_line._update_registrations(confirm=so.amount_total == 0, cancel_to_draft=False)
return res
@api.multi
def action_confirm(self):
res = super(SaleOrder, self).action_confirm()
for so in self:
if any(so.order_line.filtered(lambda line: line.event_id)):
return self.env['ir.actions.act_window'].with_context(default_sale_order_id=so.id).for_xml_id('event_sale', 'action_sale_order_event_registration')
return self.env['ir.actions.act_window'] \
.with_context(default_sale_order_id=so.id) \
.for_xml_id('event_sale', 'action_sale_order_event_registration')
return res