remove old fields from the StockItemTracking model

This commit is contained in:
Oliver Walters 2021-05-12 08:07:03 +10:00
parent 03a231bffb
commit 68b53acbf1
4 changed files with 34 additions and 26 deletions

View File

@ -389,7 +389,7 @@ class StockList(generics.ListCreateAPIView):
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
item = serializer.save(user=user, commit=False)
item = serializer.save(user=user)
# A location was *not* specified - try to infer it
if 'location' not in request.data:

View File

@ -437,14 +437,15 @@ class EditStockItemForm(HelperForm):
class TrackingEntryForm(HelperForm):
""" Form for creating / editing a StockItemTracking object.
"""
Form for creating / editing a StockItemTracking object.
Note: 2021-05-11 - This form is not currently used - should delete?
"""
class Meta:
model = StockItemTracking
fields = [
'title',
'notes',
'link',
]

View File

@ -0,0 +1,29 @@
# Generated by Django 3.2 on 2021-05-11 13:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('stock', '0062_auto_20210511_2151'),
]
operations = [
migrations.RemoveField(
model_name='stockitemtracking',
name='link',
),
migrations.RemoveField(
model_name='stockitemtracking',
name='quantity',
),
migrations.RemoveField(
model_name='stockitemtracking',
name='system',
),
migrations.RemoveField(
model_name='stockitemtracking',
name='title',
),
]

View File

@ -1626,13 +1626,10 @@ class StockItemTracking(models.Model):
Attributes:
item: ForeignKey reference to a particular StockItem
date: Date that this tracking info was created
title: Title of this tracking info (legacy, no longer used!)
tracking_type: The type of tracking information
notes: Associated notes (input by user)
link: Optional URL to external page
user: The user associated with this tracking info
deltas: The changes associated with this history item
quantity: The StockItem quantity at this point in time
"""
def get_absolute_url(self):
@ -1657,13 +1654,6 @@ class StockItemTracking(models.Model):
date = models.DateTimeField(auto_now_add=True, editable=False)
title = models.CharField(
blank=True, null=True,
max_length=250,
verbose_name=_('Title'),
help_text=_('Tracking entry title')
)
notes = models.CharField(
blank=True, null=True,
max_length=512,
@ -1671,22 +1661,10 @@ class StockItemTracking(models.Model):
help_text=_('Entry notes')
)
link = InvenTreeURLField(blank=True, verbose_name=_('Link'), help_text=_('Link to external page for further information'))
user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
system = models.BooleanField(default=False)
deltas = models.JSONField(null=True, blank=True)
quantity = models.DecimalField(
max_digits=15,
decimal_places=5,
validators=[MinValueValidator(0)],
default=1,
verbose_name=_('Quantity')
)
def rename_stock_item_test_result_attachment(instance, filename):