diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py index bf0312bd613..88b3b7c08b5 100644 --- a/addons/payment/controllers/portal.py +++ b/addons/payment/controllers/portal.py @@ -157,7 +157,7 @@ class PaymentPortal(portal.CustomerPortal): """ partner = request.env.user.partner_id acquirers_sudo = request.env['payment.acquirer'].sudo()._get_compatible_acquirers( - request.env.company.id, partner.id, force_tokenization=True + request.env.company.id, partner.id, force_tokenization=True, is_validation=True ) tokens = set(partner.payment_token_ids).union( partner.commercial_partner_id.sudo().payment_token_ids diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index f4baccbd7a7..5daccfe1890 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -271,7 +271,8 @@ class PaymentAcquirer(models.Model): @api.model def _get_compatible_acquirers( - self, company_id, partner_id, currency_id=None, force_tokenization=False, **kwargs + self, company_id, partner_id, currency_id=None, force_tokenization=False, + is_validation=False, **kwargs ): """ Select and return the acquirers matching the criteria. @@ -282,6 +283,7 @@ class PaymentAcquirer(models.Model): :param int partner_id: The partner making the payment, as a `res.partner` id :param int currency_id: The payment currency if known beforehand, as a `res.currency` id :param bool force_tokenization: Whether only acquirers allowing tokenization can be matched + :param bool is_validation: Whether the operation is a validation :param dict kwargs: Optional data. This parameter is not used here :return: The compatible acquirers :rtype: recordset of `payment.acquirer` diff --git a/addons/payment/views/payment_portal_templates.xml b/addons/payment/views/payment_portal_templates.xml index 7703b29fa6d..c60f24ac88b 100644 --- a/addons/payment/views/payment_portal_templates.xml +++ b/addons/payment/views/payment_portal_templates.xml @@ -6,7 +6,7 @@ + t-value="request.env['payment.acquirer'].sudo()._get_compatible_acquirers(request.env.company.id, partner.id, allow_tokenization=True, is_validation=True)"/>