mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-09 07:00:56 +00:00
Add "scheduled_for_deletion" field to StockItem
- If set to True, this StockItem will be deleted (soon) by the background worker - As deletion takes significant time, this prevents delete operations from blocking the UI
This commit is contained in:
@ -209,7 +209,8 @@ class StockItem(MPTTModel):
|
||||
belongs_to=None,
|
||||
customer=None,
|
||||
is_building=False,
|
||||
status__in=StockStatus.AVAILABLE_CODES
|
||||
status__in=StockStatus.AVAILABLE_CODES,
|
||||
scheduled_for_deletion=False,
|
||||
)
|
||||
|
||||
# A query filter which can be used to filter StockItem objects which have expired
|
||||
@ -588,6 +589,12 @@ class StockItem(MPTTModel):
|
||||
help_text=_('Select Owner'),
|
||||
related_name='stock_items')
|
||||
|
||||
scheduled_for_deletion = models.BooleanField(
|
||||
default=False,
|
||||
verbose_name=_('Scheduled for deletion'),
|
||||
help_text=_('This StockItem will be deleted by the background worker'),
|
||||
)
|
||||
|
||||
def is_stale(self):
|
||||
"""
|
||||
Returns True if this Stock item is "stale".
|
||||
|
Reference in New Issue
Block a user