[FIX] website_sale: ensure payment transaction is for current order
When ordering on the ecommerce, if a payment transaction was found in the session, this transaction was used as transaction for the current order. Nevertheless, if the transction is no longer linked to the current order, we should not use it. This happened, for example, when the quotation was deleted while the customer/user didn't close its browser, and the transaction id was therefore still in its session. opw-650417
This commit is contained in:
parent
49be54171c
commit
2d3e9d21a7
|
@ -731,13 +731,16 @@ class website_sale(http.Controller):
|
|||
# find an already existing transaction
|
||||
tx = request.website.sale_get_transaction()
|
||||
if tx:
|
||||
if tx.state == 'draft': # button cliked but no more info -> rewrite on tx or create a new one ?
|
||||
tx_id = tx.id
|
||||
if tx.reference != order.name:
|
||||
tx = False
|
||||
tx_id = False
|
||||
elif tx.state == 'draft': # button cliked but no more info -> rewrite on tx or create a new one ?
|
||||
tx.write({
|
||||
'acquirer_id': acquirer_id,
|
||||
'amount': order.amount_total,
|
||||
})
|
||||
tx_id = tx.id
|
||||
else:
|
||||
if not tx:
|
||||
tx_id = transaction_obj.create(cr, SUPERUSER_ID, {
|
||||
'acquirer_id': acquirer_id,
|
||||
'type': 'form',
|
||||
|
|
Loading…
Reference in New Issue