mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-03 04:00:57 +00:00
Expose "is_allocated" parameter on StockItem API
This commit is contained in:
@ -397,6 +397,16 @@ class StockItem(MPTTModel):
|
||||
|
||||
infinite = models.BooleanField(default=False)
|
||||
|
||||
def is_allocated(self):
|
||||
"""
|
||||
Return True if this StockItem is allocated to a SalesOrder or a Build
|
||||
"""
|
||||
|
||||
# TODO - For now this only checks if the StockItem is allocated to a SalesOrder
|
||||
# TODO - In future, once the "build" is working better, check this too
|
||||
|
||||
return self.sales_order_line is not None
|
||||
|
||||
def can_delete(self):
|
||||
""" Can this stock item be deleted? It can NOT be deleted under the following circumstances:
|
||||
|
||||
|
Reference in New Issue
Block a user