Delete inventory moves before receiving supplier shipments

issue9315
review315451002
This commit is contained in:
Maxime Richez
2020-05-14 23:45:16 +02:00
parent b9c0e34031
commit 20f9cf5dc3
+2
View File
@@ -425,6 +425,8 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView):
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'})