diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 6af5b3d4b7..312bff9bbe 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.utils.translation import gettext_lazy as _ from django.core.exceptions import ValidationError +from django.urls import reverse from django.db import models, transaction from django.core.validators import MinValueValidator @@ -25,7 +26,7 @@ class StockLocation(InvenTreeTree): """ def get_absolute_url(self): - return '/stock/location/{id}/'.format(id=self.id) + return reverse('stock-location-detail', kwargs={'pk': self.id}) @property def stock_items(self): @@ -109,7 +110,7 @@ class StockItem(models.Model): }) def get_absolute_url(self): - return '/stock/item/{id}/'.format(id=self.id) + return reverse('stock-item-detail', kwargs={'pk': self.id}) class Meta: unique_together = [ @@ -331,7 +332,7 @@ class StockItemTracking(models.Model): """ def get_absolute_url(self): - return '/stock/track/{id}/'.format(id=self.id) + return reverse('stock-tracking-detail', kwargs={'pk': self.id}) # Stock item item = models.ForeignKey(StockItem, on_delete=models.CASCADE, diff --git a/InvenTree/stock/test_stock_item.py b/InvenTree/stock/test_stock_item.py new file mode 100644 index 0000000000..0b4501e258 --- /dev/null +++ b/InvenTree/stock/test_stock_item.py @@ -0,0 +1,4 @@ +from django.test import TestCase + +# Create your tests here. + diff --git a/InvenTree/stock/test_stock_location.py b/InvenTree/stock/test_stock_location.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/InvenTree/stock/test_stock_location.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/InvenTree/stock/test_stock_tracking.py b/InvenTree/stock/test_stock_tracking.py new file mode 100644 index 0000000000..0b4501e258 --- /dev/null +++ b/InvenTree/stock/test_stock_tracking.py @@ -0,0 +1,4 @@ +from django.test import TestCase + +# Create your tests here. + diff --git a/InvenTree/stock/tests.py b/InvenTree/stock/tests.py deleted file mode 100644 index a79ca8be56..0000000000 --- a/InvenTree/stock/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -# from django.test import TestCase - -# Create your tests here.