diff --git a/InvenTree/order/models.py b/InvenTree/order/models.py index e5a26386ac..ddb1f5ceea 100644 --- a/InvenTree/order/models.py +++ b/InvenTree/order/models.py @@ -370,13 +370,13 @@ class PurchaseOrder(Order): tracking_info = { 'status': status, + 'purchaseorder': self.pk, } stock.add_tracking_entry( StockHistoryCode.RECEIVED_AGAINST_PURCHASE_ORDER, user, notes=notes, - url=self.get_absolute_url(), deltas=tracking_info, location=location, purchaseorder=self, diff --git a/InvenTree/stock/migrations/0061_auto_20210511_0911.py b/InvenTree/stock/migrations/0061_auto_20210511_0911.py index 32cd96d71c..0ab37250c8 100644 --- a/InvenTree/stock/migrations/0061_auto_20210511_0911.py +++ b/InvenTree/stock/migrations/0061_auto_20210511_0911.py @@ -136,7 +136,6 @@ def update_history(apps, schema_editor): location = list(matches)[0] deltas['location'] = location.pk - deltas['location_path'] = location._path else: print(f"No location match: '{text}'") diff --git a/InvenTree/stock/migrations/0062_auto_20210511_2151.py b/InvenTree/stock/migrations/0062_auto_20210511_2151.py new file mode 100644 index 0000000000..18832819ff --- /dev/null +++ b/InvenTree/stock/migrations/0062_auto_20210511_2151.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2 on 2021-05-11 11:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0061_auto_20210511_0911'), + ] + + operations = [ + migrations.AlterField( + model_name='stockitemtracking', + name='notes', + field=models.CharField(blank=True, help_text='Entry notes', max_length=512, null=True, verbose_name='Notes'), + ), + migrations.AlterField( + model_name='stockitemtracking', + name='title', + field=models.CharField(blank=True, help_text='Tracking entry title', max_length=250, null=True, verbose_name='Title'), + ), + ] diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 277d5166ee..ac870fad75 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -805,9 +805,8 @@ class StockItem(MPTTModel): StockHistoryCode.INSTALLED_INTO_ASSEMBLY, user, notes=notes, - url=self.get_absolute_url(), deltas={ - 'assembly': self.pk, + 'stockitem': self.pk, } ) @@ -816,7 +815,6 @@ class StockItem(MPTTModel): StockHistoryCode.INSTALLED_CHILD_ITEM, user, notes=notes, - url=stock_item.get_absolute_url(), deltas={ 'stockitem': stock_item.pk, } @@ -847,7 +845,6 @@ class StockItem(MPTTModel): 'stockitem': self.pk, }, notes=notes, - url=self.get_absolute_url(), ) tracking_info = { @@ -923,7 +920,7 @@ class StockItem(MPTTModel): def has_tracking_info(self): return self.tracking_info_count > 0 - def add_tracking_entry(self, entry_type, user, deltas={}, notes='', url='', **kwargs): + def add_tracking_entry(self, entry_type, user, deltas={}, notes='', **kwargs): """ Add a history tracking entry for this StockItem @@ -940,13 +937,6 @@ class StockItem(MPTTModel): if location: deltas['location'] = location.id - deltas['location_path'] = location.pathstring - - # Has a PurchaseOrder been specified? - po = kwargs.get('purchaseorder', None) - - if po: - deltas['purchaseorder'] = po.id # Quantity specified? quantity = kwargs.get('quantity', None) @@ -961,7 +951,6 @@ class StockItem(MPTTModel): date=datetime.now(), notes=notes, deltas=deltas, - link=url, system=True ) @@ -1639,14 +1628,14 @@ class StockItemTracking(models.Model): date = models.DateTimeField(auto_now_add=True, editable=False) title = models.CharField( - blank=True, + blank=True, null=True, max_length=250, verbose_name=_('Title'), help_text=_('Tracking entry title') ) notes = models.CharField( - blank=True, + blank=True, null=True, max_length=512, verbose_name=_('Notes'), help_text=_('Entry notes')