changeset 9a6c3d887a08 in modules/stock:5.6
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=9a6c3d887a08
description:
        Delete inventory moves before receiving supplier shipments

        issue9315
        review315451002
        (grafted from 8b69dbd9d6e1a0fc9bdee214895c6b7d1edd5b68)
diffstat:

 shipment.py |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r 699674b4a098 -r 9a6c3d887a08 shipment.py
--- a/shipment.py       Mon May 04 12:30:28 2020 +0200
+++ b/shipment.py       Thu May 14 23:45:16 2020 +0200
@@ -425,6 +425,8 @@
     def receive(cls, shipments):
         Move = Pool().get('stock.move')
         Move.do([m for s in shipments for m in s.incoming_moves])
+        Move.delete([m for s in shipments for m in s.inventory_moves
+            if m.state in ('draft', 'cancel')])
         cls.create_inventory_moves(shipments)
         # Set received state to allow done transition
         cls.write(shipments, {'state': 'received'})

Reply via email to