mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-14 19:15:41 +00:00
Override the "delete" behaviour for StockItem API
- Mark for deletion instead of calling database delete - Returns (almost) instantly instead of hanging - Much better UI experience when performing bulk delete operations
This commit is contained in:
@ -109,6 +109,17 @@ class StockDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
|
||||
return super().update(request, *args, **kwargs)
|
||||
|
||||
def perform_destroy(self, instance):
|
||||
"""
|
||||
Instead of "deleting" the StockItem
|
||||
(which may take a long time)
|
||||
we instead schedule it for deletion at a later date.
|
||||
|
||||
The background worker will delete these in the future
|
||||
"""
|
||||
|
||||
instance.mark_for_deletion()
|
||||
|
||||
|
||||
class StockAdjust(APIView):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user