[FIX] website_sale: free carts were not confirmed

This commit is contained in:
Denis Ledoux 2014-09-25 16:24:59 +02:00
parent 942bbad2df
commit c8f1bebcc5
1 changed files with 3 additions and 3 deletions

View File

@ -757,13 +757,13 @@ class website_sale(http.Controller):
order = request.registry['sale.order'].browse(cr, SUPERUSER_ID, sale_order_id, context=context)
assert order.id == request.session.get('sale_last_order_id')
if not tx or not order:
if not order or (order.amount_total and not tx):
return request.redirect('/shop')
if not order.amount_total or tx.state in ['pending', 'done']:
if (not order.amount_total and not tx) or tx.state in ['pending', 'done']:
# send by email
email_act = sale_order_obj.action_quotation_send(cr, SUPERUSER_ID, [order.id], context=request.context)
elif tx.state == 'cancel':
elif tx and tx.state == 'cancel':
# cancel the quotation
sale_order_obj.action_cancel(cr, SUPERUSER_ID, [order.id], context=request.context)