mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Added stock status field
This commit is contained in:
parent
7bcea2f3ac
commit
deda73a50f
@ -4,7 +4,7 @@ from .models import PartCategory, Part
|
||||
|
||||
class PartAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ('name', 'IPN', 'quantity', 'category')
|
||||
list_display = ('name', 'IPN', 'stock', 'category')
|
||||
|
||||
# Custom form for PartCategory
|
||||
class PartCategoryAdmin(admin.ModelAdmin):
|
||||
|
@ -45,7 +45,7 @@ class Part(models.Model):
|
||||
return self.stockitem_set.all()
|
||||
|
||||
@property
|
||||
def quantity(self):
|
||||
def stock(self):
|
||||
""" Return the total stock quantity for this part.
|
||||
Part may be stored in multiple locations
|
||||
"""
|
||||
|
@ -6,7 +6,7 @@ class WarehouseAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'path', 'description')
|
||||
|
||||
class StockItemAdmin(admin.ModelAdmin):
|
||||
list_display = ('part', 'quantity', 'location', 'updated')
|
||||
list_display = ('part', 'quantity', 'location', 'status', 'updated')
|
||||
|
||||
admin.site.register(Warehouse, WarehouseAdmin)
|
||||
admin.site.register(StockItem, StockItemAdmin)
|
@ -15,6 +15,20 @@ class StockItem(models.Model):
|
||||
quantity = models.IntegerField()
|
||||
updated = models.DateField(auto_now=True)
|
||||
|
||||
# Stock status types
|
||||
ITEM_IN_PROGRESS = 0
|
||||
ITEM_DAMAGED = 10
|
||||
ITEM_RETURNED = 20
|
||||
ITEM_COMPLETE = 50
|
||||
|
||||
status = models.IntegerField(default=ITEM_IN_PROGRESS,
|
||||
choices=[
|
||||
(ITEM_IN_PROGRESS, "In progress"),
|
||||
(ITEM_DAMAGED, "Damaged"),
|
||||
(ITEM_RETURNED, "Returned"),
|
||||
(ITEM_COMPLETE, "Complete")
|
||||
])
|
||||
|
||||
def __str__(self):
|
||||
return "{n} x {part} @ {loc}".format(
|
||||
n = self.quantity,
|
||||
|
Loading…
Reference in New Issue
Block a user