diff --git a/addons/payment/models/payment_transaction.py b/addons/payment/models/payment_transaction.py index 97cd6732d54..24e231baf62 100644 --- a/addons/payment/models/payment_transaction.py +++ b/addons/payment/models/payment_transaction.py @@ -357,7 +357,7 @@ class PaymentTransaction(models.Model): # For instance, the prefix 'example' is a valid match for the existing references # 'example', 'example-1' and 'example-ref', in that order. Trusting the order to infer # the sequence number would lead to a collision with 'example-1'. - search_pattern = re.compile(rf'^{prefix}{separator}(\d+)$') + search_pattern = re.compile(rf'^{re.escape(prefix)}{separator}(\d+)$') max_sequence_number = 0 # If no match is found, start the sequence with this reference for existing_reference in same_prefix_references: search_result = re.search(search_pattern, existing_reference)