diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 4022b7ec71..887c983511 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -533,7 +533,7 @@ class SupplierPart(models.Model): return cost + self.base_cost def __str__(self): - return "{sku} - {supplier}".format( + return "{supplier} ({sku})".format( sku=self.SKU, supplier=self.supplier.name) diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 636efeb293..2f61c068cd 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -77,6 +77,14 @@ class StockItem(models.Model): ) def clean(self): + """ Validate the StockItem object (separate to field validation) + + The following validation checks are performed: + + - The 'part' and 'supplier_part.part' fields cannot point to the same Part object + - The 'part' does not belong to itself + - Quantity must be 1 if the StockItem has a serial number + """ # The 'supplier_part' field must point to the same part! try: diff --git a/requirements.txt b/requirements.txt index 6cf3834241..2bc353b3ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,15 @@ -Django==2.2 -psycopg2>=2.8.1 -pillow>=5.0.0 -djangorestframework>=3.6.2 -django_filter>=1.0.2 -coreapi>=2.3.0 -pygments>=2.2.0 -tablib>=0.13.0 -django-crispy-forms>=1.7.2 -django-import-export>=1.0.0 -django-cleanup>=2.1.0 -django-qr-code==1.0.0 -flake8==3.3.0 -coverage>=4.5.3 -python-coveralls==2.9.1 \ No newline at end of file +Django==2.2 # Django package +psycopg2>=2.8.1 # PostgreSQL package +pillow>=5.0.0 # Image manipulation +djangorestframework>=3.6.2 # DRF framework +django_filter>=1.0.2 # Extended filtering options +coreapi>=2.3.0 # API documentation +pygments>=2.2.0 # Syntax highlighting +tablib>=0.13.0 # Import / export data files +django-crispy-forms>=1.7.2 # Form helpers +django-import-export>=1.0.0 # Data import / export for admin interface +django-cleanup>=2.1.0 # Manage deletion of old / unused uploaded files +django-qr-code==1.0.0 # Generate QR codes +flake8==3.3.0 # PEP checking +coverage>=4.5.3 # Unit test coverage +python-coveralls==2.9.1 # Coveralls linking (for Travis) \ No newline at end of file