Skip to content
Permalink
Browse files

[FIX] payment: wire transfer redirection

When sequentially paying multiple SO with wire transfer, the user was
always redirected to the first paid SO.

This commit fixes this issue by redirecting to the most recent one.

Technical choice:

payment_transaction rows are ordered by id desc so we can trust the
first one will be the most recent on the client side (in the scope of
this diff).

opw-1949629
Closes #31754

Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
  • Loading branch information...
johandem committed Mar 11, 2019
1 parent b8d4fe6 commit 9d3fed6d3fc20bf7f8ff999790e8386a76bcbeef
Showing with 6 additions and 4 deletions.
  1. +6 −4 addons/payment/static/src/js/payment_processing.js
@@ -81,14 +81,16 @@ odoo.define('payment.processing', function (require) {
'tx_cancel': [],
'tx_error': [],
};

if (transactions.length > 0 && transactions[0].acquirer_provider == 'transfer') {
window.location = transactions[0].return_url;
return;
}

// group the transaction according to their state
transactions.forEach(function (tx) {
var key = 'tx_' + tx.state;
if(key in render_values) {
if (tx.acquirer_provider === 'transfer') {
window.location = tx.return_url;
return;
}
render_values[key].push(tx);
}
});

0 comments on commit 9d3fed6

Please sign in to comment.
You can’t perform that action at this time.