mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 21:16:46 +00:00
peps
This commit is contained in:
parent
a5009147c3
commit
c111aaf9b2
@ -5,9 +5,11 @@ from django.db import models
|
|||||||
from part.models import Part
|
from part.models import Part
|
||||||
from InvenTree.models import InvenTreeTree
|
from InvenTree.models import InvenTreeTree
|
||||||
|
|
||||||
|
|
||||||
class Warehouse(InvenTreeTree):
|
class Warehouse(InvenTreeTree):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class StockItem(models.Model):
|
class StockItem(models.Model):
|
||||||
part = models.ForeignKey(Part,
|
part = models.ForeignKey(Part,
|
||||||
on_delete=models.CASCADE)
|
on_delete=models.CASCADE)
|
||||||
@ -31,6 +33,6 @@ class StockItem(models.Model):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{n} x {part} @ {loc}".format(
|
return "{n} x {part} @ {loc}".format(
|
||||||
n = self.quantity,
|
n=self.quantity,
|
||||||
part = self.part.name,
|
part=self.part.name,
|
||||||
loc = self.location.name)
|
loc=self.location.name)
|
||||||
|
@ -3,5 +3,5 @@ from django.conf.urls import url
|
|||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', views.index, name='index')
|
url(r'^$', views.index, name='index')
|
||||||
]
|
]
|
||||||
|
@ -3,10 +3,12 @@ from django.http import HttpResponse
|
|||||||
|
|
||||||
from .models import Warehouse, StockItem
|
from .models import Warehouse, StockItem
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
|
|
||||||
warehouses = Warehouse.objects.filter(parent = None)
|
warehouses = Warehouse.objects.filter(parent=None)
|
||||||
|
|
||||||
return render(request, 'stock/index.html',
|
return render(request, 'stock/index.html',
|
||||||
{'warehouses': warehouses
|
{'warehouses': warehouses
|
||||||
})
|
}
|
||||||
|
)
|
@ -2,9 +2,10 @@ from django.contrib import admin
|
|||||||
|
|
||||||
from .models import Supplier, SupplierPart, Customer
|
from .models import Supplier, SupplierPart, Customer
|
||||||
|
|
||||||
|
|
||||||
class CompanyAdmin(admin.ModelAdmin):
|
class CompanyAdmin(admin.ModelAdmin):
|
||||||
list_display=('name','URL','contact')
|
list_display = ('name', 'URL', 'contact')
|
||||||
|
|
||||||
admin.site.register(Customer, CompanyAdmin)
|
admin.site.register(Customer, CompanyAdmin)
|
||||||
admin.site.register(Supplier, CompanyAdmin)
|
admin.site.register(Supplier, CompanyAdmin)
|
||||||
admin.site.register(SupplierPart)
|
admin.site.register(SupplierPart)
|
||||||
|
@ -14,6 +14,8 @@ class Supplier(Company):
|
|||||||
|
|
||||||
|
|
||||||
class Customer(Company):
|
class Customer(Company):
|
||||||
|
""" Represents a customer
|
||||||
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -31,14 +33,12 @@ class SupplierPart(models.Model):
|
|||||||
|
|
||||||
MPN = models.CharField(max_length=100)
|
MPN = models.CharField(max_length=100)
|
||||||
URL = models.URLField(blank=True)
|
URL = models.URLField(blank=True)
|
||||||
description = models.CharField(max_length=250,
|
description = models.CharField(max_length=250, blank=True)
|
||||||
blank=True)
|
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{mpn} - {supplier}".format(
|
return "{mpn} - {supplier}".format(
|
||||||
mpn = self.MPN,
|
mpn=self.MPN,
|
||||||
supplier = self.supplier.name)
|
supplier=self.supplier.name)
|
||||||
|
|
||||||
|
|
||||||
class SupplierPriceBreak(models.Model):
|
class SupplierPriceBreak(models.Model):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user