Add field 'take_from' to Build

This commit is contained in:
Oliver Walters 2019-05-10 19:03:10 +10:00
parent 7ba5f7869a
commit 468322fa9d
2 changed files with 31 additions and 4 deletions

View File

@ -0,0 +1,20 @@
# Generated by Django 2.2 on 2019-05-10 08:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('stock', '0015_stockitem_delete_on_deplete'),
('build', '0012_auto_20190508_2332'),
]
operations = [
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'),
),
]

View File

@ -27,6 +27,7 @@ class Build(models.Model):
part: The part to be built (from component BOM items)
title: Brief title describing the build (required)
quantity: Number of units to be built
take_from: Location to take stock from to make this build (if blank, can take from anywhere)
status: Build status code
batch: Batch code transferred to build parts (optional)
creation_date: Date the build was created (auto)
@ -41,6 +42,11 @@ class Build(models.Model):
def get_absolute_url(self):
return reverse('build-detail', kwargs={'pk': self.id})
title = models.CharField(
blank=False,
max_length=100,
help_text='Brief description of the build')
part = models.ForeignKey('part.Part', on_delete=models.CASCADE,
related_name='builds',
limit_choices_to={
@ -50,10 +56,11 @@ class Build(models.Model):
help_text='Select part to build',
)
title = models.CharField(
blank=False,
max_length=100,
help_text='Brief description of the 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'
)
quantity = models.PositiveIntegerField(
default=1,