From 2df0f03a9a0ef58037b96fac210d8ba0b30a2196 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 20 Oct 2020 21:10:36 +1100 Subject: [PATCH] Change "ALLOCATED" to "PRODUCTION" --- InvenTree/InvenTree/status_codes.py | 8 ++++---- .../migrations/0023_auto_20201020_1009.py | 19 +++++++++++++++++++ InvenTree/build/views.py | 9 +++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 InvenTree/build/migrations/0023_auto_20201020_1009.py diff --git a/InvenTree/InvenTree/status_codes.py b/InvenTree/InvenTree/status_codes.py index 2032ec75d8..b527009ede 100644 --- a/InvenTree/InvenTree/status_codes.py +++ b/InvenTree/InvenTree/status_codes.py @@ -214,25 +214,25 @@ class BuildStatus(StatusCode): # Build status codes PENDING = 10 # Build is pending / active - ALLOCATED = 20 # Parts have been removed from stock + PRODUCTION = 20 # BuildOrder is in production CANCELLED = 30 # Build was cancelled COMPLETE = 40 # Build is complete options = { PENDING: _("Pending"), - ALLOCATED: _("Allocated"), + PRODUCTION: _("Production"), CANCELLED: _("Cancelled"), COMPLETE: _("Complete"), } colors = { PENDING: 'blue', - ALLOCATED: 'blue', + PRODUCTION: 'blue', COMPLETE: 'green', CANCELLED: 'red', } ACTIVE_CODES = [ PENDING, - ALLOCATED + PRODUCTION, ] diff --git a/InvenTree/build/migrations/0023_auto_20201020_1009.py b/InvenTree/build/migrations/0023_auto_20201020_1009.py new file mode 100644 index 0000000000..be5652d043 --- /dev/null +++ b/InvenTree/build/migrations/0023_auto_20201020_1009.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.7 on 2020-10-20 10:09 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('build', '0022_auto_20201020_0953'), + ] + + operations = [ + migrations.AlterField( + model_name='build', + name='status', + field=models.PositiveIntegerField(choices=[(10, 'Pending'), (20, 'Production'), (30, 'Cancelled'), (40, 'Complete')], default=10, help_text='Build status code', validators=[django.core.validators.MinValueValidator(0)], verbose_name='Build Status'), + ), + ] diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py index c1431b5730..02e4a8d735 100644 --- a/InvenTree/build/views.py +++ b/InvenTree/build/views.py @@ -440,6 +440,15 @@ class BuildCreate(AjaxCreateView): 'success': _('Created new build'), } + def post_save(self, new_object): + """ + Called immediately after the build has been created. + """ + + build = new_object + + print("Created:", build) + class BuildUpdate(AjaxUpdateView): """ View for editing a Build object """