Skip to content

Commit

Permalink
shopfloor, zone_picking: get right qty when pack/lot is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
sebalix committed Jan 8, 2024
1 parent c114af4 commit 4ccbab6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
16 changes: 11 additions & 5 deletions shopfloor/services/zone_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,12 +667,15 @@ def _scan_source_package(
)
else:
change_package_lot = self._actions_for("change.package.lot")
move_line = first(move_lines)
response = change_package_lot.change_package(
first(move_lines),
move_line,
package,
# FIXME we may need to pass the quantity being done
self._response_for_set_line_destination,
self._response_for_change_pack_lot,
response_ok_func=functools.partial(
self._response_for_set_line_destination,
qty_done=self._get_prefill_qty(move_line, qty=0),
),
response_error_func=self._response_for_change_pack_lot,
)
else:
response = self._list_move_lines(sublocation or self.zone_location)
Expand Down Expand Up @@ -1434,7 +1437,10 @@ def change_pack_lot(self, move_line_id, barcode):
# pre-configured callable used to generate the response as the
# change.package.lot component is not aware of the needed response type
# and related parameters for zone picking scenario
response_ok_func = functools.partial(self._response_for_set_line_destination)
response_ok_func = functools.partial(
self._response_for_set_line_destination,
qty_done=self._get_prefill_qty(move_line),
)
response_error_func = functools.partial(self._response_for_change_pack_lot)
response = None
change_package_lot = self._actions_for("change.package.lot")
Expand Down
2 changes: 2 additions & 0 deletions shopfloor/tests/test_zone_picking_change_pack_lot.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_change_pack_lot_change_pack_ok(self):
message=self.service.msg_store.package_replaced_by_package(
previous_package, self.free_package
),
qty_done=self.service._get_prefill_qty(move_line),
)

def test_change_pack_lot_change_lot_ok(self):
Expand Down Expand Up @@ -137,4 +138,5 @@ def test_change_pack_lot_change_lot_ok(self):
message=self.service.msg_store.lot_replaced_by_lot(
previous_lot, self.free_lot
),
qty_done=self.service._get_prefill_qty(move_line),
)
1 change: 1 addition & 0 deletions shopfloor/tests/test_zone_picking_select_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ def test_scan_source_barcode_package_can_replace_in_line(self):
message=self.service.msg_store.package_replaced_by_package(
package1, package1b
),
qty_done=self.service._get_prefill_qty(move_lines[0]),
)
# Check the package has been changed on the move line
self.assertEqual(self.picking1.package_level_ids[0].package_id, package1b)
Expand Down

0 comments on commit 4ccbab6

Please sign in to comment.