2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 12:05:53 +00:00

Add 'overage' field to BOM item

- Accepts absolute or percentage numbers
- Default = blank
- Now with custom validator! (for limited time only, limit one per customer)
This commit is contained in:
Oliver Walters
2019-05-15 00:16:34 +10:00
parent 35d32fd2ff
commit f6baf5d2ae
4 changed files with 101 additions and 2 deletions

View File

@ -661,6 +661,7 @@ class BomItem(models.Model):
part: Link to the parent part (the part that will be produced)
sub_part: Link to the child part (the part that will be consumed)
quantity: Number of 'sub_parts' consumed to produce one 'part'
overage: Estimated losses for a Build. Can be expressed as absolute value (e.g. '7') or a percentage (e.g. '2%')
note: Note field for this BOM item
"""
@ -688,6 +689,10 @@ class BomItem(models.Model):
# Quantity required
quantity = models.PositiveIntegerField(default=1, validators=[MinValueValidator(0)], help_text='BOM quantity for this BOM item')
overage = models.CharField(max_length=24, blank=True, validators=[validators.validate_overage],
help_text='Estimated build wastage quantity (absolute or percentage)'
)
# Note attached to this BOM line item
note = models.CharField(max_length=100, blank=True, help_text='BOM item notes')