mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add 'batch' field to BuildOutput object
This 'batch' output will be copied to any parts produced as part of this build
This commit is contained in:
parent
982803a0a7
commit
256f8eb924
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import Build
|
from .models import Build, BuildOutput
|
||||||
|
|
||||||
|
|
||||||
class BuildAdmin(admin.ModelAdmin):
|
class BuildAdmin(admin.ModelAdmin):
|
||||||
@ -11,4 +11,10 @@ class BuildAdmin(admin.ModelAdmin):
|
|||||||
list_display = ('status', )
|
list_display = ('status', )
|
||||||
|
|
||||||
|
|
||||||
|
class BuildOutputAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
|
list_display = ('build', 'part', 'batch', 'quantity', )
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Build, BuildAdmin)
|
admin.site.register(Build, BuildAdmin)
|
||||||
|
admin.site.register(BuildOutput, BuildOutputAdmin)
|
20
InvenTree/build/migrations/0005_buildoutput_batch.py
Normal file
20
InvenTree/build/migrations/0005_buildoutput_batch.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.12 on 2018-04-17 08:29
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('build', '0004_auto_20180417_0657'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='buildoutput',
|
||||||
|
name='batch',
|
||||||
|
field=models.CharField(blank=True, help_text='Batch code for this build output', max_length=100),
|
||||||
|
),
|
||||||
|
]
|
@ -40,12 +40,19 @@ class BuildOutput(models.Model):
|
|||||||
A build output represents a single build part/quantity combination
|
A build output represents a single build part/quantity combination
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
batch = models.CharField(max_length=100, blank=True,
|
||||||
|
help_text='Batch code for this build output')
|
||||||
|
|
||||||
|
# Reference to the build object of which this output is a part
|
||||||
|
# A build can have multiple outputs
|
||||||
build = models.ForeignKey(Build, on_delete=models.CASCADE,
|
build = models.ForeignKey(Build, on_delete=models.CASCADE,
|
||||||
related_name='outputs')
|
related_name='outputs')
|
||||||
|
|
||||||
|
# A reference to the part being built
|
||||||
part = models.ForeignKey(Part, on_delete=models.CASCADE,
|
part = models.ForeignKey(Part, on_delete=models.CASCADE,
|
||||||
related_name='builds')
|
related_name='builds')
|
||||||
|
|
||||||
|
# How many parts to build?
|
||||||
quantity = models.PositiveIntegerField(default=1,
|
quantity = models.PositiveIntegerField(default=1,
|
||||||
validators=[MinValueValidator(1)],
|
validators=[MinValueValidator(1)],
|
||||||
help_text='Number of parts to build')
|
help_text='Number of parts to build')
|
||||||
|
Loading…
Reference in New Issue
Block a user