mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 03:00:54 +00:00
Add verbose names for multiple Build model fields
- Improve methods for different models
This commit is contained in:
@ -426,6 +426,14 @@ class StockItem(MPTTModel):
|
||||
|
||||
return self.build_allocation_count() + self.sales_order_allocation_count()
|
||||
|
||||
def unallocated_quantity(self):
|
||||
"""
|
||||
Return the quantity of this StockItem which is *not* allocated
|
||||
"""
|
||||
|
||||
return max(self.quantity - self.allocation_count(), 0)
|
||||
|
||||
|
||||
def can_delete(self):
|
||||
""" Can this stock item be deleted? It can NOT be deleted under the following circumstances:
|
||||
|
||||
|
@ -34,6 +34,7 @@ class StockItemSerializerBrief(InvenTreeModelSerializer):
|
||||
|
||||
location_name = serializers.CharField(source='location', read_only=True)
|
||||
part_name = serializers.CharField(source='part.full_name', read_only=True)
|
||||
quantity = serializers.FloatField()
|
||||
|
||||
class Meta:
|
||||
model = StockItem
|
||||
|
Reference in New Issue
Block a user