Skip to content

Commit 90da83f

Browse files
sebalixflorentx
authored andcommitted
shopfloor, checkout: check lot on change confirmation
1 parent 7d8f7a8 commit 90da83f

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

shopfloor/actions/message.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,15 @@ def lot_changed(self):
920920
"body": _("Lot changed"),
921921
}
922922

923+
def lot_change_wrong_lot(self, lot_name):
924+
return {
925+
"message_type": "error",
926+
"body": _("Scanned lot differs from the previous scan: %(lot)s.")
927+
% {
928+
"lot": lot_name,
929+
},
930+
}
931+
923932
def lot_change_no_line_found(self):
924933
return {
925934
"message_type": "error",

shopfloor/services/checkout.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Checkout(Component):
4141
_description = __doc__
4242

4343
def _response_for_select_line(
44-
self, picking, message=None, need_confirm_pack_all=False, need_confirm_lot=False
44+
self, picking, message=None, need_confirm_pack_all=False, need_confirm_lot=None
4545
):
4646
if all(line.shopfloor_checkout_done for line in picking.move_line_ids):
4747
return self._response_for_summary(picking, message=message)
@@ -55,7 +55,7 @@ def _response_for_select_line(
5555
message=message,
5656
)
5757

58-
def _data_for_select_line(self, picking, need_confirm_pack_all=False, need_confirm_lot=False):
58+
def _data_for_select_line(self, picking, need_confirm_pack_all=False, need_confirm_lot=None):
5959
return {
6060
"picking": self._data_for_stock_picking(picking),
6161
"group_lines_by_location": True,
@@ -423,7 +423,7 @@ def _deselect_lines(self, lines):
423423
{"qty_done": 0, "shopfloor_user_id": False}
424424
)
425425

426-
def scan_line(self, picking_id, barcode, confirm_pack_all=False, confirm_lot=False):
426+
def scan_line(self, picking_id, barcode, confirm_pack_all=False, confirm_lot=None):
427427
"""Scan move lines of the stock picking
428428
429429
It allows to select move lines of the stock picking for the next
@@ -1557,7 +1557,7 @@ def scan_line(self):
15571557
"required": False,
15581558
},
15591559
"confirm_lot": {
1560-
"type": "boolean",
1560+
"type": "integer",
15611561
"nullable": True,
15621562
"required": False,
15631563
},
@@ -1783,7 +1783,7 @@ def _schema_stock_picking_details(self):
17831783
group_lines_by_location={"type": "boolean"},
17841784
show_oneline_package_content={"type": "boolean"},
17851785
need_confirm_pack_all={"type": "boolean"},
1786-
need_confirm_lot={"type": "boolean"},
1786+
need_confirm_lot={"type": "integer", "nullable": True},
17871787
)
17881788

17891789
@property

shopfloor/tests/test_checkout_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _data_for_select_line(self, picking, **kw):
5454
"group_lines_by_location": True,
5555
"show_oneline_package_content": False,
5656
"need_confirm_pack_all": False,
57-
"need_confirm_lot": False,
57+
"need_confirm_lot": None,
5858
}
5959
data.update(kw)
6060
return data

shopfloor/tests/test_checkout_scan_line.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def test_scan_line_product_in_one_package_all_package_lines_ok(self):
218218
# more than one package, it would be an error.
219219
self._test_scan_line_ok(self.product_a.barcode, picking.move_line_ids)
220220

221-
def _test_scan_line_error(self, picking, barcode, message, need_confirm_lot=False):
221+
def _test_scan_line_error(self, picking, barcode, message, need_confirm_lot=None):
222222
"""Test errors for /scan_line
223223
224224
:param picking: the picking we are currently working with (selected)
@@ -351,15 +351,15 @@ def test_scan_line_error_lot_different_change_success(self):
351351
picking,
352352
lot.name,
353353
self.msg_store.lot_different_change(),
354-
need_confirm_lot=True,
354+
need_confirm_lot=lot.id,
355355
)
356356
# Second scan to confirm the change of lot
357357
response = self.service.dispatch(
358358
"scan_line",
359359
params={
360360
"picking_id": picking.id,
361361
"barcode": lot.name,
362-
"confirm_lot": True,
362+
"confirm_lot": lot.id,
363363
},
364364
)
365365
message = self.msg_store.lot_replaced_by_lot(previous_lot, lot)

0 commit comments

Comments
 (0)