mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-06 05:30:56 +00:00
Fix "in_stock" logic for StockItem
- Not in stock if it is at a customer!
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user