mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 11:35:41 +00:00
Added skeleton for 'build' app
This commit is contained in:
22
InvenTree/stock/migrations/0010_stockitem_build.py
Normal file
22
InvenTree/stock/migrations/0010_stockitem_build.py
Normal file
@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11 on 2018-04-16 14:03
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('build', '0001_initial'),
|
||||
('stock', '0009_auto_20180416_1253'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='stockitem',
|
||||
name='build',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='build.Build'),
|
||||
),
|
||||
]
|
@ -3,16 +3,16 @@ from django.utils.translation import ugettext as _
|
||||
from django.db import models, transaction
|
||||
from django.core.validators import MinValueValidator
|
||||
from django.contrib.auth.models import User
|
||||
from django.db.models.signals import pre_delete
|
||||
from django.dispatch import receiver
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from supplier.models import SupplierPart
|
||||
from supplier.models import Customer
|
||||
from part.models import Part
|
||||
from InvenTree.models import InvenTreeTree
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from django.db.models.signals import pre_delete
|
||||
from django.dispatch import receiver
|
||||
from build.models import Build
|
||||
|
||||
|
||||
class StockLocation(InvenTreeTree):
|
||||
@ -95,6 +95,9 @@ class StockItem(models.Model):
|
||||
batch = models.CharField(max_length=100, blank=True,
|
||||
help_text='Batch code for this stock item')
|
||||
|
||||
# If this part was produced by a build, point to that build here
|
||||
build = models.ForeignKey(Build, on_delete=models.SET_NULL, blank=True, null=True)
|
||||
|
||||
# Quantity of this stock item. Value may be overridden by other settings
|
||||
quantity = models.PositiveIntegerField(validators=[MinValueValidator(0)])
|
||||
|
||||
@ -108,7 +111,6 @@ class StockItem(models.Model):
|
||||
|
||||
review_needed = models.BooleanField(default=False)
|
||||
|
||||
# Stock status types
|
||||
ITEM_OK = 10
|
||||
ITEM_ATTENTION = 50
|
||||
ITEM_DAMAGED = 55
|
||||
|
Reference in New Issue
Block a user