Before this commit:
If the barcode nomenclature uses the or `|` symbol.
The part after it would be used as a "contains" instead of a
"start with".
e.g: `123|456`
would be transformed in the JS code to `^123|456` instead of:
`^123|^456`
As such, you would have error "can't find product with barcode" if
you set such a rule and a product barcode contains the second part.
For e.g: the barcode `44445666` would match, but should not!
After this commit:
Force the second (and following if any) part to start with.
Note: in practice it is pretty rare to have `|` in the pattern, but
it is the case for a default rule in version 16, see:
https://github.com/odoo/odoo/blob/5ac58ebf983c1c02019253c0430fde3502e13e7c/addons/pos_loyalty/data/default_barcode_patterns.xml#L10
In this case, if a regular product have `044` in its product barcode,
the PoS will tell that there is no corresponding coupon instead of
adding the product.
But the issue itself still apply in version 14 in case of custom rules
opw-3356951
closesodoo/odoo#130961
X-original-commit: 103566699d3492b682219efc3614f26d2ea972e5
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Loan Sens (lse) <lse@odoo.com>