changeset 8fe70aa53a46 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=8fe70aa53a46
description:
        Delete outgoing_moves with zero quantity on packing customer shipment

        issue9737
        review316291002
diffstat:

 shipment.py                           |  2 ++
 tests/scenario_stock_shipment_out.rst |  6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 0d257e57900b -r 8fe70aa53a46 shipment.py
--- a/shipment.py       Tue Oct 27 21:12:51 2020 +0100
+++ b/shipment.py       Tue Oct 27 21:13:58 2020 +0100
@@ -1222,6 +1222,8 @@
     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 -r 0d257e57900b -r 8fe70aa53a46 tests/scenario_stock_shipment_out.rst
--- a/tests/scenario_stock_shipment_out.rst     Tue Oct 27 21:12:51 2020 +0100
+++ b/tests/scenario_stock_shipment_out.rst     Tue Oct 27 21:13:58 2020 +0100
@@ -177,7 +177,7 @@
     >>> 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 @@
     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

Reply via email to