diff --git a/addons/payment_adyen/models/payment_transaction.py b/addons/payment_adyen/models/payment_transaction.py index a3f7e78e55e..91a4da15737 100644 --- a/addons/payment_adyen/models/payment_transaction.py +++ b/addons/payment_adyen/models/payment_transaction.py @@ -173,7 +173,13 @@ class PaymentTransaction(models.Model): source_tx = self.search( [('acquirer_reference', '=', source_acquirer_reference), ('provider', '=', 'adyen')] ) - tx = self._adyen_create_refund_tx_from_feedback_data(source_tx, data) + if source_tx: + # Manually create a refund transaction with a new reference. The reference of + # the refund transaction was personalized from Adyen and could be identical to + # that of an existing transaction. + tx = self._adyen_create_refund_tx_from_feedback_data(source_tx, data) + else: # The refund was initiated for an unknown source transaction + pass # Don't do anything with the refund notification if not tx: raise ValidationError(