[FIX] website_quote: pay multiple quotations in the same session

Since aae5647988,
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.
This commit is contained in:
Denis Ledoux
2016-03-21 14:02:17 +01:00
parent 82b6f37e31
commit 06351ec607
+2 -2
View File
@@ -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(