From 5146a07ef9d4202ef32c237a5f8c47ca0fa4714d Mon Sep 17 00:00:00 2001 From: Antoine Vandevenne Date: Tue, 21 Sep 2021 09:47:51 +0200 Subject: [PATCH] [FIX] payment: avoid orphan tokens Don't use token without the partner_id set --- addons/payment/controllers/portal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py index 4739126640e..d92ddae6beb 100644 --- a/addons/payment/controllers/portal.py +++ b/addons/payment/controllers/portal.py @@ -258,8 +258,8 @@ class PaymentPortal(portal.CustomerPortal): and tokenization_required_or_requested ) elif flow == 'token': # Payment by token - token_sudo = request.env['payment.token'].sudo().browse(payment_option_id) - acquirer_sudo = token_sudo.acquirer_id + token = request.env['payment.token'].browse(payment_option_id) + acquirer_sudo = token.acquirer_id.sudo() token_id = payment_option_id tokenize = False else: