[FIX] website_sale: auto-confirm free orders upon cart validation

Orders are normally confirmed when the payment transaction
is processed, but there is no transaction for free orders.
This caused them to stay in draft until manually cancelled.
This commit is contained in:
Olivier Dony 2014-09-26 13:03:43 +02:00
parent db8035658d
commit b2b3d629f9
1 changed files with 4 additions and 0 deletions

View File

@ -761,6 +761,10 @@ class website_sale(http.Controller):
return request.redirect('/shop')
if (not order.amount_total and not tx) or tx.state in ['pending', 'done']:
if (not order.amount_total and not tx):
# Orders are confirmed by payment transactions, but there is none for free orders,
# (e.g. free events), so confirm immediately
order.action_button_confirm()
# send by email
email_act = sale_order_obj.action_quotation_send(cr, SUPERUSER_ID, [order.id], context=request.context)
elif tx and tx.state == 'cancel':