diff --git a/shipment.py b/shipment.py index 83b9a0d5ee..f1e69d1448 100644 --- a/shipment.py +++ b/shipment.py @@ -1222,6 +1222,8 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): def pack(cls, shipments): pool = Pool() Move = pool.get('stock.move') + Move.delete([m for s in shipments for m in s.outgoing_moves + if not m.quantity]) Move.assign([m for s in shipments for m in s.outgoing_moves]) def _sync_move_key(self, move): diff --git a/tests/scenario_stock_shipment_out.rst b/tests/scenario_stock_shipment_out.rst index 923e77558a..4aaaae2556 100644 --- a/tests/scenario_stock_shipment_out.rst +++ b/tests/scenario_stock_shipment_out.rst @@ -177,7 +177,7 @@ Ignore non assigned moves and pack shipment:: >>> all(m.state == 'assigned' for m in shipment_out.outgoing_moves) True >>> len(shipment_out.outgoing_moves) - 2 + 1 >>> len(shipment_out.inventory_moves) 2 >>> shipment_out.inventory_moves[0].state @@ -195,14 +195,14 @@ Set the state as Done:: True >>> planned_dates = [m.planned_date for m in ... shipment_out.outgoing_moves] - >>> planned_dates == [today, today] + >>> planned_dates == [today] True >>> effective_dates = [m.effective_date for m in ... shipment_out.outgoing_moves] >>> len(set(effective_dates)) 1 >>> len(shipment_out.outgoing_moves) - 2 + 1 >>> len(shipment_out.inventory_moves) 2 >>> shipment_out.inventory_moves[0].state