mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Reverse URL for stock models
- stock location - stock item - stock tracking - Added blank test files
This commit is contained in:
parent
b45b63545e
commit
7c91c9ba79
@ -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,
|
||||
|
4
InvenTree/stock/test_stock_item.py
Normal file
4
InvenTree/stock/test_stock_item.py
Normal file
@ -0,0 +1,4 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
3
InvenTree/stock/test_stock_location.py
Normal file
3
InvenTree/stock/test_stock_location.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
4
InvenTree/stock/test_stock_tracking.py
Normal file
4
InvenTree/stock/test_stock_tracking.py
Normal file
@ -0,0 +1,4 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
@ -1,3 +0,0 @@
|
||||
# from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
Loading…
Reference in New Issue
Block a user