mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +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:
parent
b623f34881
commit
16e00962f5
@ -109,6 +109,17 @@ class StockDetail(generics.RetrieveUpdateDestroyAPIView):
|
|||||||
|
|
||||||
return super().update(request, *args, **kwargs)
|
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):
|
class StockAdjust(APIView):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user