[FIX] payment: save the token if the option is checked in the form mode of the related acquirer.

The function was searching for the wrong acquirer in the page, so check the option was without effect
This commit is contained in:
fda-odoo
2018-01-24 15:38:54 +01:00
parent 2a59f2804f
commit 9ba1cc46c5
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ odoo.define('payment.payment_form', function (require) {
// if there's a prepare tx url set
if ($tx_url.length === 1) {
// if the user wants to save his credit card info
var form_save_token = $('input[name="o_payment_form_save_token"]').prop('checked');
var form_save_token = acquirer_form.find('input[name="o_payment_form_save_token"]').prop('checked');
// then we call the route to prepare the transaction
ajax.jsonRpc($tx_url[0].value, 'call', {
'acquirer_id': parseInt(acquirer_id),
+1 -1
View File
@@ -749,7 +749,7 @@ class WebsiteSale(http.Controller):
values['s2s_acquirers'] = [acq for acq in acquirers if acq.payment_flow == 's2s' and acq.registration_view_template_id]
values['tokens'] = request.env['payment.token'].search(
[('partner_id', '=', order.partner_id.id),
('acquirer_id', 'in', [acq.id for acq in values['s2s_acquirers']])])
('acquirer_id', 'in', acquirers.ids)])
for acq in values['form_acquirers']:
acq.form = acq.with_context(submit_class='btn btn-primary', submit_txt=_('Pay Now')).sudo().render(