diff --git a/shopfloor_reception/services/reception.py b/shopfloor_reception/services/reception.py index d44c368cdf..0b7910d518 100644 --- a/shopfloor_reception/services/reception.py +++ b/shopfloor_reception/services/reception.py @@ -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) diff --git a/shopfloor_reception/tests/test_set_quantity.py b/shopfloor_reception/tests/test_set_quantity.py index 9b4da52973..46d443a025 100644 --- a/shopfloor_reception/tests/test_set_quantity.py +++ b/shopfloor_reception/tests/test_set_quantity.py @@ -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(