Delete outgoing_moves with zero quantity on packing customer shipment
issue9737 review316291002
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user