diff --git a/addons/payment/utils.py b/addons/payment/utils.py index a724984d239..8a05e30e871 100644 --- a/addons/payment/utils.py +++ b/addons/payment/utils.py @@ -57,6 +57,10 @@ def singularize_reference_prefix(prefix='tx', separator='-', max_length=None): If the `max_length` argument is passed, the end of the prefix can be stripped before singularizing to ensure that the result accounts for no more than `max_length` characters. + Warning: Generated prefixes are *not* uniques! This function should be used only for making + transaction reference prefixes more distinguishable and *not* for operations that require the + generated value to be unique. + :param str prefix: The custom prefix to singularize :param str separator: The custom separator used to separate the prefix from the suffix :param int max_length: The maximum length of the singularized prefix diff --git a/addons/payment_ogone/models/payment_transaction.py b/addons/payment_ogone/models/payment_transaction.py index 7089d4f2468..505afcfb0b1 100644 --- a/addons/payment_ogone/models/payment_transaction.py +++ b/addons/payment_ogone/models/payment_transaction.py @@ -2,6 +2,7 @@ import logging import pprint +import uuid from lxml import etree, objectify from werkzeug import urls @@ -83,7 +84,7 @@ class PaymentTransaction(models.Model): } if self.tokenize: rendering_values.update({ - 'ALIAS': payment_utils.singularize_reference_prefix(prefix='ODOO-ALIAS'), + 'ALIAS': f'ODOO-ALIAS-{uuid.uuid4().hex}', 'ALIASUSAGE': _("Storing your payment details is necessary for future use."), }) rendering_values.update({