From 90d34cdfcf3228aa7b4e4fdd1ef3cc6f7a16f28f Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 20 Aug 2020 14:54:55 +1000 Subject: [PATCH] StockItem: Allow customer field to be blank --- .../migrations/0049_auto_20200820_0454.py | 20 +++++++++++++++++++ InvenTree/stock/models.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 InvenTree/stock/migrations/0049_auto_20200820_0454.py diff --git a/InvenTree/stock/migrations/0049_auto_20200820_0454.py b/InvenTree/stock/migrations/0049_auto_20200820_0454.py new file mode 100644 index 0000000000..ff7081b529 --- /dev/null +++ b/InvenTree/stock/migrations/0049_auto_20200820_0454.py @@ -0,0 +1,20 @@ +# Generated by Django 3.0.7 on 2020-08-20 04:54 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('company', '0023_auto_20200808_0715'), + ('stock', '0048_auto_20200807_2344'), + ] + + operations = [ + migrations.AlterField( + model_name='stockitem', + name='customer', + field=models.ForeignKey(blank=True, help_text='Customer', limit_choices_to={'is_customer': True}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='assigned_stock', to='company.Company', verbose_name='Customer'), + ), + ] diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 788bf845df..49c185220f 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -348,7 +348,7 @@ class StockItem(MPTTModel): customer = models.ForeignKey( CompanyModels.Company, on_delete=models.SET_NULL, - null=True, + null=True, blank=True, limit_choices_to={'is_customer': True}, related_name='assigned_stock', help_text=_("Customer"),