2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-09 16:58:49 +00:00
2018-04-22 21:54:12 +10:00

134 lines
7.1 KiB
Python

# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-22 11:53
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import part.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('company', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='BomItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('quantity', models.PositiveIntegerField(default=1, validators=[django.core.validators.MinValueValidator(0)])),
],
options={
'verbose_name': 'BOM Item',
},
),
migrations.CreateModel(
name='Part',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Part name (must be unique)', max_length=100, unique=True)),
('description', models.CharField(help_text='Part description', max_length=250)),
('IPN', models.CharField(blank=True, help_text='Internal Part Number', max_length=100)),
('URL', models.URLField(blank=True, help_text='Link to extenal URL')),
('image', models.ImageField(blank=True, max_length=255, null=True, upload_to=part.models.rename_part_image)),
('minimum_stock', models.PositiveIntegerField(default=0, help_text='Minimum allowed stock level', validators=[django.core.validators.MinValueValidator(0)])),
('units', models.CharField(blank=True, default='pcs', max_length=20)),
('buildable', models.BooleanField(default=False, help_text='Can this part be built from other parts?')),
('trackable', models.BooleanField(default=False, help_text='Does this part have tracking for unique items?')),
('purchaseable', models.BooleanField(default=True, help_text='Can this part be purchased from external suppliers?')),
('salable', models.BooleanField(default=False, help_text='Can this part be sold to customers?')),
('notes', models.TextField(blank=True)),
],
options={
'verbose_name': 'Part',
'verbose_name_plural': 'Parts',
},
),
migrations.CreateModel(
name='PartAttachment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('attachment', models.FileField(blank=True, null=True, upload_to=part.models.attach_file)),
('part', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='part.Part')),
],
),
migrations.CreateModel(
name='PartCategory',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True)),
('description', models.CharField(max_length=250)),
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='children', to='part.PartCategory')),
],
options={
'verbose_name': 'Part Category',
'verbose_name_plural': 'Part Categories',
},
),
migrations.CreateModel(
name='SupplierPart',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('SKU', models.CharField(help_text='Supplier stock keeping unit', max_length=100)),
('manufacturer', models.CharField(blank=True, help_text='Manufacturer', max_length=100)),
('MPN', models.CharField(blank=True, help_text='Manufacturer part number', max_length=100)),
('URL', models.URLField(blank=True)),
('description', models.CharField(blank=True, max_length=250)),
('single_price', models.DecimalField(decimal_places=3, default=0, max_digits=10)),
('base_cost', models.DecimalField(decimal_places=3, default=0, max_digits=10)),
('packaging', models.CharField(blank=True, max_length=50)),
('multiple', models.PositiveIntegerField(default=1, validators=[django.core.validators.MinValueValidator(0)])),
('minimum', models.PositiveIntegerField(default=1, validators=[django.core.validators.MinValueValidator(0)])),
('lead_time', models.DurationField(blank=True, null=True)),
('part', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='supplier_parts', to='part.Part')),
('supplier', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='parts', to='company.Company')),
],
),
migrations.CreateModel(
name='SupplierPriceBreak',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('quantity', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(0)])),
('cost', models.DecimalField(decimal_places=3, max_digits=10)),
('part', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='price_breaks', to='part.SupplierPart')),
],
),
migrations.AddField(
model_name='part',
name='category',
field=models.ForeignKey(blank=True, help_text='Part category', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='parts', to='part.PartCategory'),
),
migrations.AddField(
model_name='part',
name='default_supplier',
field=models.ForeignKey(blank=True, help_text='Default supplier part', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='default_parts', to='part.SupplierPart'),
),
migrations.AddField(
model_name='bomitem',
name='part',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bom_items', to='part.Part'),
),
migrations.AddField(
model_name='bomitem',
name='sub_part',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='used_in', to='part.Part'),
),
migrations.AlterUniqueTogether(
name='supplierpricebreak',
unique_together=set([('part', 'quantity')]),
),
migrations.AlterUniqueTogether(
name='supplierpart',
unique_together=set([('part', 'supplier', 'SKU')]),
),
migrations.AlterUniqueTogether(
name='bomitem',
unique_together=set([('part', 'sub_part')]),
),
]