mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-03 13:58:47 +00:00
Add 'reference' field to BOM item model
This commit is contained in:
parent
72486448b8
commit
3085db44af
23
InvenTree/part/migrations/0012_auto_20190627_2144.py
Normal file
23
InvenTree/part/migrations/0012_auto_20190627_2144.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 2.2.2 on 2019-06-27 11:44
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('part', '0011_part_revision'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='bomitem',
|
||||||
|
name='reference',
|
||||||
|
field=models.CharField(blank=True, help_text='BOM item reference', max_length=500),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='bomitem',
|
||||||
|
name='note',
|
||||||
|
field=models.CharField(blank=True, help_text='BOM item notes', max_length=500),
|
||||||
|
),
|
||||||
|
]
|
@ -843,15 +843,19 @@ class Part(models.Model):
|
|||||||
'Part',
|
'Part',
|
||||||
'Description',
|
'Description',
|
||||||
'Quantity',
|
'Quantity',
|
||||||
|
'Overage',
|
||||||
|
'Reference',
|
||||||
'Note',
|
'Note',
|
||||||
])
|
])
|
||||||
|
|
||||||
for it in self.bom_items.all():
|
for it in self.bom_items.all().order_by('id'):
|
||||||
line = []
|
line = []
|
||||||
|
|
||||||
line.append(it.sub_part.full_name)
|
line.append(it.sub_part.full_name)
|
||||||
line.append(it.sub_part.description)
|
line.append(it.sub_part.description)
|
||||||
line.append(it.quantity)
|
line.append(it.quantity)
|
||||||
|
line.append(it.overage)
|
||||||
|
line.append(it.reference)
|
||||||
line.append(it.note)
|
line.append(it.note)
|
||||||
|
|
||||||
data.append(line)
|
data.append(line)
|
||||||
@ -969,6 +973,7 @@ class BomItem(models.Model):
|
|||||||
part: Link to the parent part (the part that will be produced)
|
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)
|
sub_part: Link to the child part (the part that will be consumed)
|
||||||
quantity: Number of 'sub_parts' consumed to produce one 'part'
|
quantity: Number of 'sub_parts' consumed to produce one 'part'
|
||||||
|
reference: BOM reference field (e.g. part designators)
|
||||||
overage: Estimated losses for a Build. Can be expressed as absolute value (e.g. '7') or a percentage (e.g. '2%')
|
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
|
note: Note field for this BOM item
|
||||||
"""
|
"""
|
||||||
@ -1001,8 +1006,10 @@ class BomItem(models.Model):
|
|||||||
help_text='Estimated build wastage quantity (absolute or percentage)'
|
help_text='Estimated build wastage quantity (absolute or percentage)'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
reference = models.CharField(max_length=500, blank=True, help_text='BOM item reference')
|
||||||
|
|
||||||
# Note attached to this BOM line item
|
# Note attached to this BOM line item
|
||||||
note = models.CharField(max_length=100, blank=True, help_text='BOM item notes')
|
note = models.CharField(max_length=500, blank=True, help_text='BOM item notes')
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
""" Check validity of the BomItem model.
|
""" Check validity of the BomItem model.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user