diff --git a/addons/payment/models/account_payment.py b/addons/payment/models/account_payment.py index cb416b81c14..33823eeadc8 100644 --- a/addons/payment/models/account_payment.py +++ b/addons/payment/models/account_payment.py @@ -44,8 +44,8 @@ class AccountPayment(models.Model): def _compute_amount_available_for_refund(self): for payment in self: - tx = payment.payment_transaction_id - if tx.acquirer_id.sudo().support_refund and tx.operation != 'refund': + tx_sudo = payment.payment_transaction_id.sudo() + if tx_sudo.acquirer_id.support_refund and tx_sudo.operation != 'refund': # Only consider refund transactions that are confirmed by summing the amounts of # payments linked to such refund transactions. Indeed, should a refund transaction # be stuck forever in a transient state (due to webhook failure, for example), the