mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add "allow_variants" field to BomItem
This commit is contained in:
parent
96624d1175
commit
5c71f04360
18
InvenTree/part/migrations/0066_bomitem_allow_variants.py
Normal file
18
InvenTree/part/migrations/0066_bomitem_allow_variants.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2 on 2021-06-01 03:58
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('part', '0065_auto_20210505_2144'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='bomitem',
|
||||
name='allow_variants',
|
||||
field=models.BooleanField(default=False, help_text='Stock items for variant parts can be used for this BOM item', verbose_name='Allow Variants'),
|
||||
),
|
||||
]
|
@ -2240,6 +2240,7 @@ class BomItem(models.Model):
|
||||
note: Note field for this BOM item
|
||||
checksum: Validation checksum for the particular BOM line item
|
||||
inherited: This BomItem can be inherited by the BOMs of variant parts
|
||||
allow_variants: Stock for part variants can be substituted for this BomItem
|
||||
"""
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
@ -2288,6 +2289,12 @@ class BomItem(models.Model):
|
||||
help_text=_('This BOM item is inherited by BOMs for variant parts'),
|
||||
)
|
||||
|
||||
allow_variants = models.BooleanField(
|
||||
default=False,
|
||||
verbose_name=_('Allow Variants'),
|
||||
help_text=_('Stock items for variant parts can be used for this BOM item')
|
||||
)
|
||||
|
||||
def get_item_hash(self):
|
||||
""" Calculate the checksum hash of this BOM line item:
|
||||
|
||||
|
@ -453,6 +453,7 @@ class BomItemSerializer(InvenTreeModelSerializer):
|
||||
class Meta:
|
||||
model = BomItem
|
||||
fields = [
|
||||
'allow_variants',
|
||||
'inherited',
|
||||
'note',
|
||||
'optional',
|
||||
@ -460,16 +461,16 @@ class BomItemSerializer(InvenTreeModelSerializer):
|
||||
'pk',
|
||||
'part',
|
||||
'part_detail',
|
||||
'purchase_price_avg',
|
||||
'purchase_price_max',
|
||||
'purchase_price_min',
|
||||
'purchase_price_range',
|
||||
'quantity',
|
||||
'reference',
|
||||
'sub_part',
|
||||
'sub_part_detail',
|
||||
# 'price_range',
|
||||
'validated',
|
||||
'purchase_price_min',
|
||||
'purchase_price_max',
|
||||
'purchase_price_avg',
|
||||
'purchase_price_range',
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user