SupplierOrderLineItem gets reference to internal part

- For keeping track of how many of an internal part is on order!
This commit is contained in:
Oliver 2018-04-18 01:21:18 +10:00
parent 12a97204b1
commit 1400128f9f
2 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-17 15:20
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('part', '0022_auto_20180417_0819'),
('supplier', '0013_merge_20180417_1517'),
]
operations = [
migrations.RenameField(
model_name='supplierorderlineitem',
old_name='part',
new_name='supplier_part',
),
migrations.AddField(
model_name='supplierorderlineitem',
name='internal_part',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='part.Part'),
),
migrations.AlterUniqueTogether(
name='supplierorderlineitem',
unique_together=set([('order', 'line_number'), ('order', 'internal_part'), ('order', 'supplier_part')]),
),
]

View File

@ -160,14 +160,17 @@ class SupplierOrderLineItem(models.Model):
class Meta:
unique_together = [
('order', 'line_number'),
('order', 'part'),
('order', 'supplier_part'),
('order', 'internal_part'),
]
order = models.ForeignKey(SupplierOrder, on_delete=models.CASCADE)
line_number = models.PositiveIntegerField(default=1)
part = models.ForeignKey(SupplierPart, null=True, blank=True, on_delete=models.SET_NULL)
internal_part = models.ForeignKey(Part, null=True, blank=True, on_delete=models.SET_NULL)
supplier_part = models.ForeignKey(SupplierPart, null=True, blank=True, on_delete=models.SET_NULL)
quantity = models.PositiveIntegerField(default=1)