diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 8f4b04e54f..0a9fc6b8bd 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -140,6 +140,7 @@ class StockItem(MPTTModel): sales_order=None, build_order=None, belongs_to=None, + customer=None, status__in=StockStatus.AVAILABLE_CODES ) @@ -609,6 +610,10 @@ class StockItem(MPTTModel): if self.build_order is not None: return False + # Not 'in stock' if it has been assigned to a customer + if self.customer is not None: + return False + # Not 'in stock' if the status code makes it unavailable if self.status in StockStatus.UNAVAILABLE_CODES: return False diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index 00ad0063d5..9b0b182848 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -97,16 +97,15 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}