Delete outgoing_moves with zero quantity on packing customer shipment

issue9737
review316291002
This commit is contained in:
Maxime Richez
2020-10-27 21:13:58 +01:00
parent b32cb04a10
commit 6bc5f2dfa3
2 changed files with 5 additions and 3 deletions
+2
View File
@@ -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):
+3 -3
View File
@@ -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