mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add quantity field to StockItemTracking
- Keep track of historical levels of part availability
This commit is contained in:
parent
93bb0bf6f4
commit
926d717190
@ -0,0 +1,19 @@
|
||||
# Generated by Django 2.2 on 2019-04-12 14:09
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0004_auto_20190412_2030'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='stockitemtracking',
|
||||
name='quantity',
|
||||
field=models.PositiveIntegerField(default=1, validators=[django.core.validators.MinValueValidator(0)]),
|
||||
),
|
||||
]
|
@ -209,6 +209,7 @@ class StockItem(models.Model):
|
||||
item=self,
|
||||
title=title,
|
||||
user=user,
|
||||
quantity=self.quantity,
|
||||
date=datetime.now().date(),
|
||||
notes=notes,
|
||||
system=system
|
||||
@ -346,6 +347,9 @@ class StockItemTracking(models.Model):
|
||||
# Was this tracking note auto-generated by the system?
|
||||
system = models.BooleanField(default=False)
|
||||
|
||||
# Keep track of the StockItem quantity throughout the tracking history
|
||||
quantity = models.PositiveIntegerField(validators=[MinValueValidator(0)], default=1)
|
||||
|
||||
# TODO
|
||||
# image = models.ImageField(upload_to=func, max_length=255, null=True, blank=True)
|
||||
|
||||
|
@ -35,6 +35,7 @@ class StockTrackingSerializer(serializers.ModelSerializer):
|
||||
'date',
|
||||
'title',
|
||||
'notes',
|
||||
'quantity',
|
||||
'user',
|
||||
'system',
|
||||
]
|
||||
@ -43,6 +44,7 @@ class StockTrackingSerializer(serializers.ModelSerializer):
|
||||
'date',
|
||||
'user',
|
||||
'system',
|
||||
'quantity',
|
||||
]
|
||||
|
||||
|
||||
|
@ -215,6 +215,10 @@
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'quantity',
|
||||
title: 'Quantity',
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'user',
|
||||
|
Loading…
Reference in New Issue
Block a user