From b2b3d629f930d7036c01295e652509667e228655 Mon Sep 17 00:00:00 2001
From: Olivier Dony <odo@openerp.com>
Date: Fri, 26 Sep 2014 13:03:43 +0200
Subject: [PATCH] [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.
---
 addons/website_sale/controllers/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py
index 50a8db022893..86bc6646f162 100644
--- a/addons/website_sale/controllers/main.py
+++ b/addons/website_sale/controllers/main.py
@@ -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':
-- 
GitLab