changeset a62c7da27489 in modules/stock:5.0
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=a62c7da27489
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 f75039b0b69e -r a62c7da27489 shipment.py
--- a/shipment.py       Mon Mar 09 18:34:41 2020 +0100
+++ b/shipment.py       Thu May 14 23:45:16 2020 +0200
@@ -444,6 +444,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