diff --git a/addons/payment/static/src/js/payment_form.js b/addons/payment/static/src/js/payment_form.js index 5da7cfbe2ea..b1d503f340d 100644 --- a/addons/payment/static/src/js/payment_form.js +++ b/addons/payment/static/src/js/payment_form.js @@ -86,20 +86,6 @@ odoo.define('payment.payment_form', function (require){ var form_save_token = false; var $tx_url = this.$el.find('input[name="prepare_tx_url"]'); - // Here we take the values we need to send to the acquirer and generate a form with them - var html_form = '
'; - // if there's a prepare tx url set if($tx_url.length == 1) { @@ -109,8 +95,20 @@ odoo.define('payment.payment_form', function (require){ 'save_token': form_save_token }).then(function(result){ if(result) { - // we append the form to the body and send it. - $(html_form).appendTo("body").submit(); + // TBE: I really don't like how it is designed, but I can't do better with how e-commerce works/ + var ignored_inputs = ['data_set', 'o_payment_form_save_token']; + var html_form = ''; + + // we append the form to the body + var form = $(html_form).appendTo("body"); + // we remove the "unused" inputs + for(var i = 0; i < ignored_inputs.length; i++) { + form.find('input[name="' + ignored_inputs[i] + '"]').remove(); + } + // we submit the form + form.submit(); } else { self.error(_t('Server Error'), @@ -124,7 +122,8 @@ odoo.define('payment.payment_form', function (require){ else { // we append the form to the body and send it. - $(html_form).appendTo("body").submit(); + // $(html_form).appendTo("body").submit(); + this.error(_t("Cannot set-up the payment"), _t("We're unable to process your payment.
")); } } // if the user is using an old payment diff --git a/addons/website_quote/controllers/main.py b/addons/website_quote/controllers/main.py index 7849d14ccc7..cd87591f2fa 100644 --- a/addons/website_quote/controllers/main.py +++ b/addons/website_quote/controllers/main.py @@ -186,12 +186,12 @@ class sale_quote(http.Controller): }) request.session['quote_%s_transaction_id' % order.id] = tx.id - return True - # return tx.render_sale_button(order, '/quote/%s/%s' % (order_id, token) if token else '/quote/%s' % order_id, - # submit_txt=_('Pay & Confirm'), render_values={ - # 'type': order._get_payment_type(), - # 'alias_usage': _('If we store your payment information on our server, subscription payments will be made automatically.'), - # }) + # return True + return tx.render_sale_button(order, '/quote/%s/%s' % (order_id, token) if token else '/quote/%s' % order_id, + submit_txt=_('Pay & Confirm'), render_values={ + 'type': order._get_payment_type(), + 'alias_usage': _('If we store your payment information on our server, subscription payments will be made automatically.'), + }) @http.route('/quote/