Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2019-04-28 21:26:33 +10:00
commit 207d2bb4d3
3 changed files with 24 additions and 16 deletions

View File

@ -533,7 +533,7 @@ class SupplierPart(models.Model):
return cost + self.base_cost return cost + self.base_cost
def __str__(self): def __str__(self):
return "{sku} - {supplier}".format( return "{supplier} ({sku})".format(
sku=self.SKU, sku=self.SKU,
supplier=self.supplier.name) supplier=self.supplier.name)

View File

@ -77,6 +77,14 @@ class StockItem(models.Model):
) )
def clean(self): 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! # The 'supplier_part' field must point to the same part!
try: try:

View File

@ -1,15 +1,15 @@
Django==2.2 Django==2.2 # Django package
psycopg2>=2.8.1 psycopg2>=2.8.1 # PostgreSQL package
pillow>=5.0.0 pillow>=5.0.0 # Image manipulation
djangorestframework>=3.6.2 djangorestframework>=3.6.2 # DRF framework
django_filter>=1.0.2 django_filter>=1.0.2 # Extended filtering options
coreapi>=2.3.0 coreapi>=2.3.0 # API documentation
pygments>=2.2.0 pygments>=2.2.0 # Syntax highlighting
tablib>=0.13.0 tablib>=0.13.0 # Import / export data files
django-crispy-forms>=1.7.2 django-crispy-forms>=1.7.2 # Form helpers
django-import-export>=1.0.0 django-import-export>=1.0.0 # Data import / export for admin interface
django-cleanup>=2.1.0 django-cleanup>=2.1.0 # Manage deletion of old / unused uploaded files
django-qr-code==1.0.0 django-qr-code==1.0.0 # Generate QR codes
flake8==3.3.0 flake8==3.3.0 # PEP checking
coverage>=4.5.3 coverage>=4.5.3 # Unit test coverage
python-coveralls==2.9.1 python-coveralls==2.9.1 # Coveralls linking (for Travis)