diff --git a/InvenTree/build/migrations/0001_initial.py b/InvenTree/build/migrations/0001_initial.py index aa7356389a..85fcb1b827 100644 --- a/InvenTree/build/migrations/0001_initial.py +++ b/InvenTree/build/migrations/0001_initial.py @@ -1,6 +1,5 @@ -# Generated by Django 2.2 on 2019-05-18 14:04 +# Generated by Django 2.2 on 2019-05-20 09:22 -from django.conf import settings import django.core.validators from django.db import migrations, models import django.db.models.deletion @@ -11,9 +10,6 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('part', '0002_auto_20190519_0004'), - ('stock', '0001_initial'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ @@ -29,9 +25,6 @@ class Migration(migrations.Migration): ('completion_date', models.DateField(blank=True, null=True)), ('URL', models.URLField(blank=True, help_text='Link to external URL')), ('notes', models.TextField(blank=True, help_text='Extra build notes')), - ('completed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='builds_completed', to=settings.AUTH_USER_MODEL)), - ('part', models.ForeignKey(help_text='Select part to build', limit_choices_to={'active': True, 'buildable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='builds', to='part.Part')), - ('take_from', models.ForeignKey(blank=True, help_text='Select location to take stock from for this build (leave blank to take from any stock location)', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sourcing_builds', to='stock.StockLocation')), ], ), migrations.CreateModel( @@ -40,10 +33,6 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('quantity', models.PositiveIntegerField(default=1, help_text='Stock quantity to allocate to build', validators=[django.core.validators.MinValueValidator(1)])), ('build', models.ForeignKey(help_text='Build to allocate parts', on_delete=django.db.models.deletion.CASCADE, related_name='allocated_stock', to='build.Build')), - ('stock_item', models.ForeignKey(help_text='Stock Item to allocate to build', on_delete=django.db.models.deletion.CASCADE, related_name='allocations', to='stock.StockItem')), ], - options={ - 'unique_together': {('build', 'stock_item')}, - }, ), ] diff --git a/InvenTree/build/migrations/0002_auto_20190520_1922.py b/InvenTree/build/migrations/0002_auto_20190520_1922.py new file mode 100644 index 0000000000..1a20ff5bd4 --- /dev/null +++ b/InvenTree/build/migrations/0002_auto_20190520_1922.py @@ -0,0 +1,44 @@ +# Generated by Django 2.2 on 2019-05-20 09:22 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('stock', '0001_initial'), + ('part', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('build', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='builditem', + name='stock_item', + field=models.ForeignKey(help_text='Stock Item to allocate to build', on_delete=django.db.models.deletion.CASCADE, related_name='allocations', to='stock.StockItem'), + ), + migrations.AddField( + model_name='build', + name='completed_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='builds_completed', to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='build', + name='part', + field=models.ForeignKey(help_text='Select part to build', limit_choices_to={'active': True, 'buildable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='builds', to='part.Part'), + ), + migrations.AddField( + model_name='build', + name='take_from', + field=models.ForeignKey(blank=True, help_text='Select location to take stock from for this build (leave blank to take from any stock location)', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sourcing_builds', to='stock.StockLocation'), + ), + migrations.AlterUniqueTogether( + name='builditem', + unique_together={('build', 'stock_item')}, + ), + ] diff --git a/InvenTree/company/migrations/0001_initial.py b/InvenTree/company/migrations/0001_initial.py index b4da1df89e..540b4bf47e 100644 --- a/InvenTree/company/migrations/0001_initial.py +++ b/InvenTree/company/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2 on 2019-05-18 14:04 +# Generated by Django 2.2 on 2019-05-20 09:22 import company.models import django.core.validators diff --git a/InvenTree/company/migrations/0002_auto_20190519_0004.py b/InvenTree/company/migrations/0002_auto_20190520_1922.py similarity index 96% rename from InvenTree/company/migrations/0002_auto_20190519_0004.py rename to InvenTree/company/migrations/0002_auto_20190520_1922.py index c34c315d48..df4c1c8910 100644 --- a/InvenTree/company/migrations/0002_auto_20190519_0004.py +++ b/InvenTree/company/migrations/0002_auto_20190520_1922.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2 on 2019-05-18 14:04 +# Generated by Django 2.2 on 2019-05-20 09:22 from django.db import migrations, models import django.db.models.deletion @@ -9,8 +9,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('company', '0001_initial'), ('part', '0001_initial'), + ('company', '0001_initial'), ] operations = [ diff --git a/InvenTree/part/migrations/0001_initial.py b/InvenTree/part/migrations/0001_initial.py index c0413a909a..cf7d7b8b98 100644 --- a/InvenTree/part/migrations/0001_initial.py +++ b/InvenTree/part/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2 on 2019-05-18 14:04 +# Generated by Django 2.2 on 2019-05-20 09:22 import InvenTree.validators from django.conf import settings diff --git a/InvenTree/part/migrations/0002_auto_20190519_0004.py b/InvenTree/part/migrations/0002_auto_20190520_1922.py similarity index 97% rename from InvenTree/part/migrations/0002_auto_20190519_0004.py rename to InvenTree/part/migrations/0002_auto_20190520_1922.py index 02df1a7fad..098176a44d 100644 --- a/InvenTree/part/migrations/0002_auto_20190519_0004.py +++ b/InvenTree/part/migrations/0002_auto_20190520_1922.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2 on 2019-05-18 14:04 +# Generated by Django 2.2 on 2019-05-20 09:22 from django.conf import settings from django.db import migrations, models @@ -10,10 +10,10 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('company', '0002_auto_20190519_0004'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('company', '0002_auto_20190520_1922'), ('stock', '0001_initial'), ('part', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ diff --git a/InvenTree/stock/migrations/0001_initial.py b/InvenTree/stock/migrations/0001_initial.py index 2fc4e96608..ea639842a9 100644 --- a/InvenTree/stock/migrations/0001_initial.py +++ b/InvenTree/stock/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2 on 2019-05-18 14:04 +# Generated by Django 2.2 on 2019-05-20 09:22 from django.conf import settings import django.core.validators @@ -11,9 +11,9 @@ class Migration(migrations.Migration): initial = True dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('company', '0001_initial'), ('part', '0001_initial'), + ('company', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ @@ -70,7 +70,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='stockitem', name='part', - field=models.ForeignKey(help_text='Base part', on_delete=django.db.models.deletion.CASCADE, related_name='locations', to='part.Part'), + field=models.ForeignKey(help_text='Base part', on_delete=django.db.models.deletion.CASCADE, related_name='stock_items', to='part.Part'), ), migrations.AddField( model_name='stockitem', diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index fcb1622f27..3680079b30 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -186,7 +186,7 @@ class StockItem(models.Model): } ) - part = models.ForeignKey('part.Part', on_delete=models.CASCADE, related_name='locations', help_text='Base part') + part = models.ForeignKey('part.Part', on_delete=models.CASCADE, related_name='stock_items', help_text='Base part') supplier_part = models.ForeignKey('company.SupplierPart', blank=True, null=True, on_delete=models.SET_NULL, help_text='Select a matching supplier part for this stock item')