From 4c185d4a3f9e141a967518e9a9607cd64bf51cb2 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Thu, 18 Aug 2022 16:47:45 +0000 Subject: [PATCH] [FIX] payment: correct message for validation transactions The message returned by `_get_sent_message` for validation transaction was wrong, refering to a token, but there is no token on validation transactions. This doesn't have to be fixed in stable since validation transactions are not linked to any specific document, so the wrong message was never posted anywhere. Now that we improve the display logic of payment tokens and noticed the problem, this commit fixes it (for code consistency, and if any custom code/... uses this message as well. Part-of: odoo/odoo#94978 --- addons/payment/models/payment_transaction.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/payment/models/payment_transaction.py b/addons/payment/models/payment_transaction.py index 5b7bfee0897..279f588f717 100644 --- a/addons/payment/models/payment_transaction.py +++ b/addons/payment/models/payment_transaction.py @@ -1056,12 +1056,19 @@ class PaymentTransaction(models.Model): "Refund transaction reference: %(ref)s (%(acq_name)s).", amount=formatted_amount, ref=self.reference, acq_name=self.acquirer_id.name ) - else: # 'online_token' + elif self.operation in ('online_token', 'offline'): message = _( "A transaction with reference %(ref)s has been initiated using the payment method " "%(token_name)s (%(acq_name)s).", ref=self.reference, token_name=self.token_id.name, acq_name=self.acquirer_id.name ) + else: # 'validation' + message = _( + "A transaction with reference %(ref)s has been initiated to save a new payment " + "method (%(acq_name)s)", + ref=self.reference, + acq_name=self.acquirer_id.name, + ) return message def _get_received_message(self):