Skip to content
Open
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
4 changes: 2 additions & 2 deletions shopfloor_reception/services/reception.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,8 @@ def _set_quantity__by_location(self, picking, selected_line, location):
selected_line.location_dest_id = location
return self._response_for_select_move(picking)

def _set_quantity__by_lot(self, picking, selected_line, barcode):
if selected_line.lot_id.name == barcode or selected_line.lot_name == barcode:
def _set_quantity__by_lot(self, picking, selected_line, lot):
if selected_line.lot_id.name == lot.name or selected_line.lot_name == lot.name:
selected_line.qty_done += 1
return self._response_for_set_quantity(picking, selected_line)

Expand Down
22 changes: 22 additions & 0 deletions shopfloor_reception/tests/test_set_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,28 @@ def test_set_quantity_scan_product(self):
},
)

def test_set_quantity_scan_lot(self):
picking = self._create_picking()
selected_move_line = picking.move_line_ids.filtered(
lambda l: l.product_id == self.product_a
)
lot = self._create_lot(
product_id=selected_move_line.product_id.id, name="Test Lot"
)
selected_move_line.write({"shopfloor_user_id": self.env.uid, "lot_id": lot.id})
self.service.dispatch(
"set_quantity",
params={
"picking_id": picking.id,
"selected_line_id": selected_move_line.id,
# ↓ UI calls with 0 by default
"quantity": 0.0,
"barcode": "Test Lot",
},
)

self.assertEqual(selected_move_line.qty_done, 1)

def test_set_quantity_scan_wrong_lot(self):
# create lot "4" for product b
self.env["stock.lot"].create(
Expand Down
Loading