From d692c18274840bf9647e085b116e4e96b2a5aa10 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 17 Feb 2021 21:53:15 +1100 Subject: [PATCH] Add 'inherited' field to BomItem --- .../part/migrations/0063_bomitem_inherited.py | 18 ++++++++++++++++++ InvenTree/part/models.py | 7 +++++++ 2 files changed, 25 insertions(+) create mode 100644 InvenTree/part/migrations/0063_bomitem_inherited.py diff --git a/InvenTree/part/migrations/0063_bomitem_inherited.py b/InvenTree/part/migrations/0063_bomitem_inherited.py new file mode 100644 index 0000000000..569236fd72 --- /dev/null +++ b/InvenTree/part/migrations/0063_bomitem_inherited.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.7 on 2021-02-17 10:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0062_merge_20210105_0056'), + ] + + operations = [ + migrations.AddField( + model_name='bomitem', + name='inherited', + field=models.BooleanField(default=False, help_text='This BOM item is inherited by BOMs for variant parts', verbose_name='Inherited'), + ), + ] diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 0257caee0c..5fba030f81 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -1977,6 +1977,7 @@ class BomItem(models.Model): 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 checksum: Validation checksum for the particular BOM line item + inherited: This BomItem can be inherited by the BOMs of variant parts """ def save(self, *args, **kwargs): @@ -2016,6 +2017,12 @@ class BomItem(models.Model): checksum = models.CharField(max_length=128, blank=True, help_text=_('BOM line checksum')) + inherited = models.BooleanField( + default=False, + verbose_name=_('Inherited'), + help_text=_('This BOM item is inherited by BOMs for variant parts'), + ) + def get_item_hash(self): """ Calculate the checksum hash of this BOM line item: