From 06351ec6076680e192d45ccc97bb68f5e103e3ab Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 21 Mar 2016 13:56:25 +0100 Subject: [PATCH] [FIX] website_quote: pay multiple quotations in the same session Since aae56479880bdfec83d2d77af6b125486bfa90f6, the payment transaction ID is set in the session. Unlike ecommerce carts, this is possible to open multiple quotations at the same time (one browser tab on SO001, another one on SO002), and therefore to pay multiple quotes at the same time. This revision makes sure to get from the session the transaction of the right quote. That way, the message "Your payment has been received, thank you for your trust.", is not displayed when opening a new quote when another one was paid just before. --- addons/website_quote/controllers/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_quote/controllers/main.py b/addons/website_quote/controllers/main.py index 122b72ff7a6..e78bf64903a 100644 --- a/addons/website_quote/controllers/main.py +++ b/addons/website_quote/controllers/main.py @@ -40,7 +40,7 @@ class sale_quote(http.Controller): pdfhttpheaders = [('Content-Type', 'application/pdf'), ('Content-Length', len(pdf))] return request.make_response(pdf, headers=pdfhttpheaders) user = request.registry['res.users'].browse(request.cr, SUPERUSER_ID, request.uid, context=request.context) - tx_id = request.session.get('quote_transaction_id') + tx_id = request.session.get('quote_%s_transaction_id' % order.id) if not tx_id: tx_id = request.registry['payment.transaction'].search(request.cr, SUPERUSER_ID, [('reference', '=', order.name)], context=request.context) tx = request.registry['payment.transaction'].browse(request.cr, SUPERUSER_ID, tx_id, context=request.context) if tx_id else False @@ -204,7 +204,7 @@ class sale_quote(http.Controller): 'sale_order_id': order.id, 'callback_eval': "self.env['sale.order']._confirm_online_quote(self.sale_order_id.id, self)" }, context=context) - request.session['quote_transaction_id'] = tx_id + request.session['quote_%s_transaction_id' % order.id] = tx_id tx = transaction_obj.browse(cr, SUPERUSER_ID, tx_id, context=context) # update quotation request.registry['sale.order'].write(