mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
bb99e45676
@ -31,7 +31,7 @@ class SupplierPart(models.Model):
|
||||
- A Part may be available from multiple suppliers
|
||||
"""
|
||||
|
||||
part = models.ForeignKey(Part, null=True, blank=True, on_delete=models.CASCADE, related_name='supplier_parts')
|
||||
part = models.ForeignKey(Part, null=True, blank=True, on_delete=models.CASCADE)
|
||||
supplier = models.ForeignKey(Supplier, on_delete=models.CASCADE)
|
||||
SKU = models.CharField(max_length=100)
|
||||
|
||||
@ -41,9 +41,11 @@ class SupplierPart(models.Model):
|
||||
URL = models.URLField(blank=True)
|
||||
description = models.CharField(max_length=250, blank=True)
|
||||
|
||||
single_price = models.DecimalField(max_digits=10,
|
||||
decimal_places=3,
|
||||
default=0)
|
||||
# Default price for a single unit
|
||||
single_price = models.DecimalField(max_digits=10, decimal_places=3, default=0)
|
||||
|
||||
# Base charge added to order independent of quantity e.g. "Reeling Fee"
|
||||
base_cost = models.DecimalField(max_digits=10, decimal_places=3, default=0)
|
||||
|
||||
# packaging that the part is supplied in, e.g. "Reel"
|
||||
packaging = models.CharField(max_length=50, blank=True)
|
||||
@ -51,6 +53,9 @@ class SupplierPart(models.Model):
|
||||
# multiple that the part is provided in
|
||||
multiple = models.PositiveIntegerField(default=1)
|
||||
|
||||
# Mimumum number required to order
|
||||
minimum = models.PositiveIntegerField(default=1)
|
||||
|
||||
# lead time for parts that cannot be delivered immediately
|
||||
lead_time = models.DurationField(blank=True, null=True)
|
||||
|
||||
|
@ -4,6 +4,6 @@ from .models import UniquePart
|
||||
|
||||
|
||||
class UniquePartAdmin(admin.ModelAdmin):
|
||||
list_display = ('part', 'revision', 'serial', 'creation_date')
|
||||
list_display = ('part', 'revision', 'serial', 'status', 'creation_date')
|
||||
|
||||
admin.site.register(UniquePart, UniquePartAdmin)
|
||||
|
@ -1,5 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
@ -36,15 +36,16 @@ class UniquePart(models.Model):
|
||||
PART_DAMAGED = 40
|
||||
PART_DESTROYED = 50
|
||||
|
||||
status = models.IntegerField(default=PART_IN_PROGRESS,
|
||||
choices=[
|
||||
(PART_IN_PROGRESS, "In progress"),
|
||||
(PART_IN_STOCK, "In stock"),
|
||||
(PART_SHIPPED, "Shipped"),
|
||||
(PART_RETURNED, "Returned"),
|
||||
(PART_DAMAGED, "Damaged"),
|
||||
(PART_DESTROYED, "Destroyed"),
|
||||
])
|
||||
PART_STATUS_CODES = {
|
||||
PART_IN_PROGRESS: _("In progress"),
|
||||
PART_IN_STOCK: _("In stock"),
|
||||
PART_SHIPPED: _("Shipped"),
|
||||
PART_RETURNED: _("Returned"),
|
||||
PART_DAMAGED: _("Damaged"),
|
||||
PART_DESTROYED: _("Destroyed")
|
||||
}
|
||||
|
||||
status = models.IntegerField(default=PART_IN_PROGRESS, choices=PART_STATUS_CODES.items())
|
||||
|
||||
def __str__(self):
|
||||
return self.part.name
|
||||
|
Loading…
Reference in New Issue
Block a user