diff --git a/InvenTree/part/migrations/0008_auto_20190417_0013.py b/InvenTree/part/migrations/0008_auto_20190417_0013.py new file mode 100644 index 0000000000..e7311e2be8 --- /dev/null +++ b/InvenTree/part/migrations/0008_auto_20190417_0013.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2 on 2019-04-16 14:13 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0007_auto_20190417_0007'), + ] + + operations = [ + migrations.AlterField( + model_name='supplierpart', + name='part', + field=models.ForeignKey(limit_choices_to={'purchasable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='supplier_parts', to='part.Part'), + ), + ] diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index a1decb1069..c002143315 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -458,7 +458,9 @@ class SupplierPart(models.Model): # Link to an actual part # The part will have a field 'supplier_parts' which links to the supplier part options part = models.ForeignKey(Part, on_delete=models.CASCADE, - related_name='supplier_parts') + related_name='supplier_parts', + limit_choices_to={'purchasable': True}, + ) supplier = models.ForeignKey(Company, on_delete=models.CASCADE, related_name='parts')