[FIX] payment: link tokens to refund transactions

Whenever making a refund for a transaction with a saved token
the token will appear also on the refund transaction.
It is useful to keep track of which token was used in each
transaction, this remains true for refunds.
The token will also appear on the payments.

Task - 2694760

closes odoo/odoo#85484

X-original-commit: 351812a81ec29fe96bf3766c45ea3b51f4055066
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Horacio Tellez
2022-02-28 12:01:48 +00:00
parent 6168590525
commit 3db051e7f5
@@ -599,6 +599,7 @@ class PaymentTransaction(models.Model):
'reference': self._compute_reference(self.provider, prefix=f'R-{self.reference}'),
'amount': -(amount_to_refund or self.amount),
'currency_id': self.currency_id.id,
'token_id': self.token_id.id,
'operation': 'refund',
'source_transaction_id': self.id,
'partner_id': self.partner_id.id,