@@ -33,7 +33,17 @@ def on_barcode_scanned(self, barcode):
33
33
limit = 1 ,
34
34
)
35
35
if product :
36
- self ._check_product (product , qty )
36
+ if not self ._check_product (product , qty ):
37
+ return {
38
+ "warning" : {
39
+ "title" : _ ("Wrong barcode" ),
40
+ "message" : _ (
41
+ 'The barcode "%(barcode)s" does not match any '
42
+ 'product on this picking.'
43
+ )
44
+ % {"barcode" : barcode },
45
+ }
46
+ }
37
47
return {
38
48
"warning" : {
39
49
"title" : _ ("Wrong barcode" ),
@@ -50,8 +60,6 @@ def _check_product(self, product, qty=1.0):
50
60
"""
51
61
# Get back the move line to increase. If multiple are found, chose
52
62
# arbitrary the first one that doesn't have qty_done set.
53
- # Filter out the ones processed by `_check_location` and the ones already
54
- # having a # destination package.
55
63
picking_move_lines = self .move_line_ids_without_package
56
64
if not self .show_reserved :
57
65
picking_move_lines = self .move_line_nosuggest_ids
@@ -62,14 +70,5 @@ def _check_product(self, product, qty=1.0):
62
70
)[:1 ]
63
71
if corresponding_ml :
64
72
corresponding_ml .qty_done += qty
65
- else :
66
- return {
67
- "warning" : {
68
- "title" : _ ("Wrong barcode" ),
69
- "message" : _ (
70
- 'The barcode "%(barcode)s" does not match any product on this picking.'
71
- )
72
- % {"barcode" : barcode },
73
- }
74
- }
75
- return True
73
+ return True
74
+ return False
0 commit comments