Skip to content

Commit

Permalink
Merge PR #950 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by jbaudoux
  • Loading branch information
OCA-git-bot committed Nov 25, 2024
2 parents 495f840 + 517608b commit dd4e4db
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
32 changes: 24 additions & 8 deletions shopfloor/services/cluster_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,16 +696,32 @@ def _set_destination_pack_update_quantity(self, move_line, quantity, barcode):
if not product:
packaging = search.packaging_from_scan(barcode)
product = packaging.product_id
if product and move_line.product_id == product:
quantity += packaging.qty or 1.0
response = self._response_for_scan_destination(move_line, qty_done=quantity)
return response
if product:
if move_line.product_id == product:
quantity += packaging.qty or 1.0
response = self._response_for_scan_destination(
move_line, qty_done=quantity
)
return response
return self._response_for_scan_destination(
move_line,
message=self.msg_store.wrong_record(product),
qty_done=quantity,
)
# Handle barcode of a lot
lot = search.lot_from_scan(barcode)
if lot and move_line.lot_id == lot:
quantity += 1.0
response = self._response_for_scan_destination(move_line, qty_done=quantity)
return response
if lot:
if move_line.lot_id == lot:
quantity += 1.0
response = self._response_for_scan_destination(
move_line, qty_done=quantity
)
return response
return self._response_for_scan_destination(
move_line,
message=self.msg_store.wrong_record(lot),
qty_done=quantity,
)
return response

def scan_destination_pack(self, picking_batch_id, move_line_id, barcode, quantity):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2020 Camptocamp SA (http://www.camptocamp.com)
# Copyright 2024 Michael Tietz (MT Software) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from .test_cluster_picking_base import ClusterPickingCommonCase
Expand Down Expand Up @@ -76,15 +77,16 @@ def test_scan_destination_pack_increment_with_wrong_product(self):
)
# Ensure the qty has not changed.
self.assertEqual(line.qty_done, previous_qty_done)

new_move_line = self.env["stock.move.line"].search(
[("move_id", "=", line.move_id.id), ("id", ">", line.id)]
)
self.assertFalse(new_move_line)
expected_qty_done = qty_done
self.assert_response(
response,
next_state="scan_destination",
data=self._line_data(line, qty_done=expected_qty_done),
message=self.service.msg_store.bin_not_found_for_barcode(
self.product_b.barcode
),
message=self.service.msg_store.wrong_record(self.product_b),
)

def test_scan_destination_pack_increment_with_packaging(self):
Expand Down

0 comments on commit dd4e4db

Please sign in to comment.