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,
|
item=self,
|
||||||
title=title,
|
title=title,
|
||||||
user=user,
|
user=user,
|
||||||
|
quantity=self.quantity,
|
||||||
date=datetime.now().date(),
|
date=datetime.now().date(),
|
||||||
notes=notes,
|
notes=notes,
|
||||||
system=system
|
system=system
|
||||||
@ -346,6 +347,9 @@ class StockItemTracking(models.Model):
|
|||||||
# Was this tracking note auto-generated by the system?
|
# Was this tracking note auto-generated by the system?
|
||||||
system = models.BooleanField(default=False)
|
system = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
# Keep track of the StockItem quantity throughout the tracking history
|
||||||
|
quantity = models.PositiveIntegerField(validators=[MinValueValidator(0)], default=1)
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
# image = models.ImageField(upload_to=func, max_length=255, null=True, blank=True)
|
# image = models.ImageField(upload_to=func, max_length=255, null=True, blank=True)
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ class StockTrackingSerializer(serializers.ModelSerializer):
|
|||||||
'date',
|
'date',
|
||||||
'title',
|
'title',
|
||||||
'notes',
|
'notes',
|
||||||
|
'quantity',
|
||||||
'user',
|
'user',
|
||||||
'system',
|
'system',
|
||||||
]
|
]
|
||||||
@ -43,6 +44,7 @@ class StockTrackingSerializer(serializers.ModelSerializer):
|
|||||||
'date',
|
'date',
|
||||||
'user',
|
'user',
|
||||||
'system',
|
'system',
|
||||||
|
'quantity',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,6 +215,10 @@
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: 'Quantity',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'user',
|
field: 'user',
|
||||||
|
Loading…
Reference in New Issue
Block a user