[FIX] point_of_sale: barcode patterns must match barcode as prefix, (and not anywhere in barcode)

This commit is contained in:
Frédéric van der Essen
2015-05-05 14:04:39 +02:00
parent 19161952cc
commit 00236aafcc
@@ -155,7 +155,14 @@ openerp.barcodes = function(instance) {
match['base_code'] = match['base_code'].replace("\\\\", "\\").replace("\{", "{").replace("\}","}").replace("\.",".");
}
match['match'] = match['base_code'].substr(0,base_pattern.length).match(base_pattern);
if (base_pattern[0] !== '^') {
base_pattern = "^" + base_pattern;
}
if (base_pattern[base_pattern.length -1] !== '$') {
base_pattern = base_pattern + ".*$";
}
match.match = match.base_code.match(base_pattern);
return match;
},