[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
This commit is contained in:
Victor Feyens
2022-08-19 14:28:08 +02:00
parent abe4a01303
commit 4c185d4a3f
+8 -1
View File
@@ -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):