Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] shopfloor: cluster_picking do not create a new move line #950

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading