From a1f33c40842ed40f67ae721bf409f213d5bd0f2c Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 19 Nov 2019 10:22:46 +1100 Subject: [PATCH] Change build allocation quantity to decimal field --- .../migrations/0007_auto_20191118_2321.py | 19 +++++++ InvenTree/build/models.py | 27 +++++----- InvenTree/locale/de/LC_MESSAGES/django.po | 54 +++++++++++++++++-- InvenTree/locale/en/LC_MESSAGES/django.po | 54 +++++++++++++++++-- InvenTree/locale/es/LC_MESSAGES/django.po | 54 +++++++++++++++++-- 5 files changed, 183 insertions(+), 25 deletions(-) create mode 100644 InvenTree/build/migrations/0007_auto_20191118_2321.py diff --git a/InvenTree/build/migrations/0007_auto_20191118_2321.py b/InvenTree/build/migrations/0007_auto_20191118_2321.py new file mode 100644 index 0000000000..da6b455f60 --- /dev/null +++ b/InvenTree/build/migrations/0007_auto_20191118_2321.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.5 on 2019-11-18 23:21 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('build', '0006_auto_20190913_1407'), + ] + + operations = [ + migrations.AlterField( + model_name='builditem', + name='quantity', + field=models.DecimalField(decimal_places=5, default=1, help_text='Stock quantity to allocate to build', max_digits=15, validators=[django.core.validators.MinValueValidator(1)]), + ), + ] diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 57792340e8..51e1b7f5e7 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -48,7 +48,7 @@ class Build(models.Model): title = models.CharField( blank=False, max_length=100, - help_text='Brief description of the build') + help_text=_('Brief description of the build')) part = models.ForeignKey('part.Part', on_delete=models.CASCADE, related_name='builds', @@ -57,28 +57,28 @@ class Build(models.Model): 'assembly': True, 'active': True }, - help_text='Select part to build', + help_text=_('Select part to build'), ) take_from = models.ForeignKey('stock.StockLocation', on_delete=models.SET_NULL, related_name='sourcing_builds', null=True, blank=True, - help_text='Select location to take stock from for this build (leave blank to take from any stock location)' + help_text=_('Select location to take stock from for this build (leave blank to take from any stock location)') ) quantity = models.PositiveIntegerField( default=1, validators=[MinValueValidator(1)], - help_text='Number of parts to build' + help_text=_('Number of parts to build') ) status = models.PositiveIntegerField(default=BuildStatus.PENDING, choices=BuildStatus.items(), validators=[MinValueValidator(0)], - help_text='Build status') + help_text=_('Build status')) batch = models.CharField(max_length=100, blank=True, null=True, - help_text='Batch code for this build output') + help_text=_('Batch code for this build output')) creation_date = models.DateField(auto_now=True, editable=False) @@ -90,10 +90,9 @@ class Build(models.Model): related_name='builds_completed' ) - URL = InvenTreeURLField(blank=True, help_text='Link to external URL') + URL = InvenTreeURLField(blank=True, help_text=_('Link to external URL')) - notes = models.TextField(blank=True, help_text='Extra build notes') - """ Notes attached to each build output """ + notes = models.TextField(blank=True, help_text=_('Extra build notes')) @transaction.atomic def cancelBuild(self, user): @@ -399,18 +398,20 @@ class BuildItem(models.Model): Build, on_delete=models.CASCADE, related_name='allocated_stock', - help_text='Build to allocate parts' + help_text=_('Build to allocate parts') ) stock_item = models.ForeignKey( 'stock.StockItem', on_delete=models.CASCADE, related_name='allocations', - help_text='Stock Item to allocate to build', + help_text=_('Stock Item to allocate to build'), ) - quantity = models.PositiveIntegerField( + quantity = models.DecimalField( + decimal_places=5, + max_digits=15, default=1, validators=[MinValueValidator(1)], - help_text='Stock quantity to allocate to build' + help_text=_('Stock quantity to allocate to build') ) diff --git a/InvenTree/locale/de/LC_MESSAGES/django.po b/InvenTree/locale/de/LC_MESSAGES/django.po index 0fa15c0901..551e1efe42 100644 --- a/InvenTree/locale/de/LC_MESSAGES/django.po +++ b/InvenTree/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-11-18 23:10+0000\n" +"POT-Creation-Date: 2019-11-18 23:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -141,6 +141,40 @@ msgstr "" msgid "Confirm build completion" msgstr "" +#: build/models.py:52 +msgid "Brief description of the build" +msgstr "" + +#: build/models.py:61 +msgid "Select part to build" +msgstr "" + +#: build/models.py:67 +msgid "" +"Select location to take stock from for this build (leave blank to take from " +"any stock location)" +msgstr "" + +#: build/models.py:73 +msgid "Number of parts to build" +msgstr "" + +#: build/models.py:79 +msgid "Build status" +msgstr "" + +#: build/models.py:82 +msgid "Batch code for this build output" +msgstr "" + +#: build/models.py:94 +msgid "Link to external URL" +msgstr "" + +#: build/models.py:96 +msgid "Extra build notes" +msgstr "" + #: build/models.py:381 #, python-brace-format msgid "Selected stock item not found in BOM for part '{p}'" @@ -151,6 +185,18 @@ msgstr "" msgid "Allocated quantity ({n}) must not exceed available quantity ({q})" msgstr "" +#: build/models.py:402 +msgid "Build to allocate parts" +msgstr "" + +#: build/models.py:409 +msgid "Stock Item to allocate to build" +msgstr "" + +#: build/models.py:417 +msgid "Stock quantity to allocate to build" +msgstr "" + #: build/templates/build/allocate_edit.html:5 msgid "Allocate Stock to Build" msgstr "" @@ -931,15 +977,15 @@ msgstr "" msgid "Serialized {n} items" msgstr "" -#: stock/models.py:738 +#: stock/models.py:750 msgid "Tracking entry title" msgstr "" -#: stock/models.py:740 +#: stock/models.py:752 msgid "Entry notes" msgstr "" -#: stock/models.py:742 +#: stock/models.py:754 msgid "Link to external page for further information" msgstr "" diff --git a/InvenTree/locale/en/LC_MESSAGES/django.po b/InvenTree/locale/en/LC_MESSAGES/django.po index 0fa15c0901..551e1efe42 100644 --- a/InvenTree/locale/en/LC_MESSAGES/django.po +++ b/InvenTree/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-11-18 23:10+0000\n" +"POT-Creation-Date: 2019-11-18 23:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -141,6 +141,40 @@ msgstr "" msgid "Confirm build completion" msgstr "" +#: build/models.py:52 +msgid "Brief description of the build" +msgstr "" + +#: build/models.py:61 +msgid "Select part to build" +msgstr "" + +#: build/models.py:67 +msgid "" +"Select location to take stock from for this build (leave blank to take from " +"any stock location)" +msgstr "" + +#: build/models.py:73 +msgid "Number of parts to build" +msgstr "" + +#: build/models.py:79 +msgid "Build status" +msgstr "" + +#: build/models.py:82 +msgid "Batch code for this build output" +msgstr "" + +#: build/models.py:94 +msgid "Link to external URL" +msgstr "" + +#: build/models.py:96 +msgid "Extra build notes" +msgstr "" + #: build/models.py:381 #, python-brace-format msgid "Selected stock item not found in BOM for part '{p}'" @@ -151,6 +185,18 @@ msgstr "" msgid "Allocated quantity ({n}) must not exceed available quantity ({q})" msgstr "" +#: build/models.py:402 +msgid "Build to allocate parts" +msgstr "" + +#: build/models.py:409 +msgid "Stock Item to allocate to build" +msgstr "" + +#: build/models.py:417 +msgid "Stock quantity to allocate to build" +msgstr "" + #: build/templates/build/allocate_edit.html:5 msgid "Allocate Stock to Build" msgstr "" @@ -931,15 +977,15 @@ msgstr "" msgid "Serialized {n} items" msgstr "" -#: stock/models.py:738 +#: stock/models.py:750 msgid "Tracking entry title" msgstr "" -#: stock/models.py:740 +#: stock/models.py:752 msgid "Entry notes" msgstr "" -#: stock/models.py:742 +#: stock/models.py:754 msgid "Link to external page for further information" msgstr "" diff --git a/InvenTree/locale/es/LC_MESSAGES/django.po b/InvenTree/locale/es/LC_MESSAGES/django.po index 0fa15c0901..551e1efe42 100644 --- a/InvenTree/locale/es/LC_MESSAGES/django.po +++ b/InvenTree/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-11-18 23:10+0000\n" +"POT-Creation-Date: 2019-11-18 23:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -141,6 +141,40 @@ msgstr "" msgid "Confirm build completion" msgstr "" +#: build/models.py:52 +msgid "Brief description of the build" +msgstr "" + +#: build/models.py:61 +msgid "Select part to build" +msgstr "" + +#: build/models.py:67 +msgid "" +"Select location to take stock from for this build (leave blank to take from " +"any stock location)" +msgstr "" + +#: build/models.py:73 +msgid "Number of parts to build" +msgstr "" + +#: build/models.py:79 +msgid "Build status" +msgstr "" + +#: build/models.py:82 +msgid "Batch code for this build output" +msgstr "" + +#: build/models.py:94 +msgid "Link to external URL" +msgstr "" + +#: build/models.py:96 +msgid "Extra build notes" +msgstr "" + #: build/models.py:381 #, python-brace-format msgid "Selected stock item not found in BOM for part '{p}'" @@ -151,6 +185,18 @@ msgstr "" msgid "Allocated quantity ({n}) must not exceed available quantity ({q})" msgstr "" +#: build/models.py:402 +msgid "Build to allocate parts" +msgstr "" + +#: build/models.py:409 +msgid "Stock Item to allocate to build" +msgstr "" + +#: build/models.py:417 +msgid "Stock quantity to allocate to build" +msgstr "" + #: build/templates/build/allocate_edit.html:5 msgid "Allocate Stock to Build" msgstr "" @@ -931,15 +977,15 @@ msgstr "" msgid "Serialized {n} items" msgstr "" -#: stock/models.py:738 +#: stock/models.py:750 msgid "Tracking entry title" msgstr "" -#: stock/models.py:740 +#: stock/models.py:752 msgid "Entry notes" msgstr "" -#: stock/models.py:742 +#: stock/models.py:754 msgid "Link to external page for further information" msgstr ""