mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Added "ProjectRun" model
This commit is contained in:
parent
2b998a1931
commit
aafa8781d7
@ -48,9 +48,9 @@ class ProjectPart(models.Model):
|
|||||||
|
|
||||||
part = models.ForeignKey(Part, on_delete=models.CASCADE)
|
part = models.ForeignKey(Part, on_delete=models.CASCADE)
|
||||||
project = models.ForeignKey(Project, on_delete=models.CASCADE)
|
project = models.ForeignKey(Project, on_delete=models.CASCADE)
|
||||||
quantity = models.IntegerField(default=1)
|
quantity = models.PositiveIntegerField(default=1)
|
||||||
overage = models.FloatField(default=0)
|
overage = models.FloatField(default=0)
|
||||||
overage_type = models.IntegerField(
|
overage_type = models.PositiveIntegerField(
|
||||||
default=1,
|
default=1,
|
||||||
choices=[
|
choices=[
|
||||||
(OVERAGE_PERCENT, "Percent"),
|
(OVERAGE_PERCENT, "Percent"),
|
||||||
@ -61,3 +61,17 @@ class ProjectPart(models.Model):
|
|||||||
return "{quan} x {name}".format(
|
return "{quan} x {name}".format(
|
||||||
name=self.part.name,
|
name=self.part.name,
|
||||||
quan=self.quantity)
|
quan=self.quantity)
|
||||||
|
|
||||||
|
class ProjectRun(models.Model):
|
||||||
|
""" A single run of a particular project.
|
||||||
|
Tracks the number of 'units' made in the project.
|
||||||
|
Provides functionality to update stock,
|
||||||
|
based on both:
|
||||||
|
a) Parts used (project inputs)
|
||||||
|
b) Parts produced (project outputs)
|
||||||
|
"""
|
||||||
|
|
||||||
|
project = models.ForeignKey(Project, on_delete=models.CASCADE)
|
||||||
|
quantity = models.PositiveIntegerField(default=1)
|
||||||
|
|
||||||
|
run_date = models.DateField(auto_now_add=True)
|
||||||
|
@ -44,6 +44,11 @@ class SupplierPart(models.Model):
|
|||||||
URL = models.URLField(blank=True)
|
URL = models.URLField(blank=True)
|
||||||
description = models.CharField(max_length=250, blank=True)
|
description = models.CharField(max_length=250, blank=True)
|
||||||
|
|
||||||
|
single_price = models.DecimalField(max_digits=10, decimal_places=3)
|
||||||
|
|
||||||
|
# packaging that the part is supplied in, e.g. "Reel"
|
||||||
|
packaging = models.CharField(max_length=50, blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{mpn} - {supplier}".format(
|
return "{mpn} - {supplier}".format(
|
||||||
mpn=self.MPN,
|
mpn=self.MPN,
|
||||||
@ -58,7 +63,7 @@ class SupplierPriceBreak(models.Model):
|
|||||||
|
|
||||||
part = models.ForeignKey(SupplierPart,
|
part = models.ForeignKey(SupplierPart,
|
||||||
on_delete=models.CASCADE)
|
on_delete=models.CASCADE)
|
||||||
quantity = models.IntegerField()
|
quantity = models.PositiveIntegerField()
|
||||||
cost = models.DecimalField(max_digits=10, decimal_places=3)
|
cost = models.DecimalField(max_digits=10, decimal_places=3)
|
||||||
currency = models.CharField(max_length=10,
|
currency = models.CharField(max_length=10,
|
||||||
blank=True)
|
blank=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user