[FIX] event_sale: confirm registration

When a user registers for an event on the front-end, the confirmation of
the associated SO will also confirm the registration. However, if a SO
is created manually and a ticket event is added to it, the confirmation
of the SO will not trigger the confirmation of the registration.

In the second case, the registration simply doesn't exist yet at
confirmation and is created by the method `default_get` of
`registration.editor`.

We make sure to confirm these registration when we make the final
reservation.

opw-688665
This commit is contained in:
Nicolas Martinelli
2016-10-10 10:24:57 +02:00
parent 1c2a7b8e3f
commit 9548fcb2e5
@@ -54,6 +54,9 @@ class SaleOrderEventRegistration(models.TransientModel):
wiz_registration.registration_id.write(wiz_registration.get_registration_data()[0])
else:
Registration.create(wiz_registration.get_registration_data()[0])
if self.env.context.get('active_model') == 'sale.order':
for order in self.env['sale.order'].browse(self.env.context.get('active_ids', [])):
order.order_line._update_registrations(confirm=True)
return {'type': 'ir.actions.act_window_close'}