[FIX] payment_stripe: missing route

In case an invoice is required to be paid thanks to the route
'/my/invoices/', the user is redirected to '/shop/payment/transaction/'.
If website_sale is not installed, this causes a crash.

Complement of 2bd17285ea

opw-813481
This commit is contained in:
Nicolas Martinelli
2018-02-02 09:17:30 +01:00
committed by Nicolas Martinelli
parent 4df087b24d
commit ad9edfc2dd
+11 -1
View File
@@ -97,7 +97,10 @@ odoo.define('payment_stripe.stripe', function(require) {
if (so_id) {
so_id = parseInt(so_id[1]);
}
var invoice_id = $("input[name='return_url']").val().match(/invoices\/([0-9]+)/) || undefined;
if (invoice_id) {
invoice_id = parseInt(invoice_id[1]);
}
var currency = $("input[name='currency']").val();
var currency_id = $("input[name='currency_id']").val();
@@ -127,6 +130,13 @@ odoo.define('payment_stripe.stripe', function(require) {
}).then(function (data) {
try { provider_form.innerHTML = data; } catch (e) {};
});
} else if (window.location.href.includes("/my/invoices/")) {
var create_tx = ajax.jsonRpc('/invoice/pay/' + invoice_id + '/form_tx/', 'call', {
access_token: access_token,
acquirer_id: acquirer_id
}).then(function (data) {
try { provider_form.innerHTML = data; } catch (e) {};
});
}
else {
var create_tx = ajax.jsonRpc('/shop/payment/transaction/' + acquirer_id, 'call', {