[FIX] payment: hide acquirers not allowing tokenization when required

Before this commit, the /payment/pay page would not filter out acquirers
configured to allow tokenization when it was although required for the
payment. For example, for sales order with a subscription product (which
requires tokenization), acquirers that don't allow tokenization would be
shown to the customer if they pay from the /payment/pay page, but not if
they pay from the portal view of the SO.

This commit makes sure the sales order id is correctly propagated to the
Subscription app which then flags the payment as requiring tokenization.

closes odoo/odoo#86202

X-original-commit: 9ab7b2447f2ece46f1a25335ab76f06323f03d22
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Antoine Vandevenne (anv)
2022-03-10 15:39:49 +00:00
parent 11ab6d05ee
commit 2713c3d104
+1 -1
View File
@@ -110,7 +110,7 @@ class PaymentPortal(portal.CustomerPortal):
# Select all acquirers and tokens that match the constraints
acquirers_sudo = request.env['payment.acquirer'].sudo()._get_compatible_acquirers(
company_id, partner_sudo.id, currency_id=currency.id
company_id, partner_sudo.id, currency_id=currency.id, **kwargs
) # In sudo mode to read the fields of acquirers and partner (if not logged in)
if acquirer_id in acquirers_sudo.ids: # Only keep the desired acquirer if it's suitable
acquirers_sudo = acquirers_sudo.browse(acquirer_id)