odoo/odoo#244366

Created by fw-bot
Merged at 239a5cbcd5f66e9e23657e853d5ad60da368469f

Statuses:

label
odoo-dev:master-19.0-opw-5386575-changing_sequence_traceback-artn-491458-fw
head
e45be0b89f4551143b2d427e8784be3d92b4a908
merged
2 days ago by Arthur Nanson (artn)
odoo/odoo
19.0 #239515
saas-19.1 #244346
master #244366

[FIX] point_of_sale: prevent traceback with sequence prefix

Steps to reproduce:
- Go to the sequence interface, and chose the config number 1 for a pos.order
- In the prefix field, enter something with characters that are not numbers
- Go to a PoS with config number 1 active and make a purchase
- A traceback appears saying that we can't convert the sequence to an Integer

Why the fix:
Having a custom prefix with letters used to work, but in version 19, we now store the sequence_number with the prefix, which can be composed of characters which can not be stored in an Integer field such as sequence_number.

To prevent this error, we remove the prefix and the suffix (which has the same issue) from the sequence_number before storing it. We then add the prefix and the suffix back when computing the order's name, so that it's consistant with the prefix and the suffix the user chose.

This is the way the order's name was computed before version 19.0, which saw the prefix and suffix disappear from the order's name.

opw-5386575

Forward-Port-Of: #239515