Limit choices for the 'Part' reference in the new model

This commit is contained in:
Oliver Walters 2020-09-18 09:16:59 +10:00
parent 71c0406cf3
commit a95dd86540
2 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 3.0.7 on 2020-09-17 23:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('part', '0049_partsellpricebreak'),
]
operations = [
migrations.AlterField(
model_name='partsellpricebreak',
name='part',
field=models.ForeignKey(limit_choices_to={'salable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='salepricebreaks', to='part.Part'),
),
]

View File

@ -1236,7 +1236,8 @@ class PartSellPriceBreak(common.models.PriceBreak):
part = models.ForeignKey(
Part, on_delete=models.CASCADE,
related_name='salepricebreaks'
related_name='salepricebreaks',
limit_choices_to={'salable': True}
)
class Meta: