Change build allocation quantity to decimal field

This commit is contained in:
Oliver Walters 2019-11-19 10:22:46 +11:00
parent dbdbe69f7f
commit a1f33c4084
5 changed files with 183 additions and 25 deletions

View File

@ -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)]),
),
]

View File

@ -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')
)

View File

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""

View File

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""

View File

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""