# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-19 06:20
from __future__ import unicode_literals

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import river.models.fields.state


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('river', '0008_auto_20161017_0916'),
    ]

    operations = [
        migrations.CreateModel(
            name='Manufacturer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64)),
                ('url', models.CharField(blank=True, max_length=64, null=True)),
                ('lookup_url', models.CharField(blank=True, help_text='url pattern to look up part number', max_length=64, null=True)),
                ('phone', models.CharField(max_length=16, validators=[django.core.validators.RegexValidator(regex='^\\+?1?\\d{9,15}$')])),
                ('support_phone', models.CharField(blank=True, max_length=16, validators=[django.core.validators.RegexValidator(regex='^\\+?1?\\d{9,15}$')])),
                ('location', models.CharField(max_length=50)),
                ('address', models.CharField(max_length=200)),
                ('is_active', models.BooleanField(default=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Material',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('product_name', models.CharField(max_length=100, verbose_name='Product')),
                ('order_number', models.CharField(max_length=20, unique=True, verbose_name='Order No')),
                ('gra_num', models.CharField(max_length=20, unique=True, verbose_name='GRA No')),
                ('chem_formula', models.CharField(blank=True, max_length=45, null=True, verbose_name='Chemical formula')),
                ('description', models.TextField(blank=True)),
                ('date_arrived', models.DateField()),
                ('manufacture_date', models.DateField()),
                ('expiry_date', models.DateField()),
                ('weight', models.PositiveIntegerField(verbose_name='Weight(kg)')),
                ('unit_price', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Unit Price(GH₵)')),
                ('quantity', models.PositiveIntegerField()),
            ],
            options={
                'ordering': ('product_name',),
            },
        ),
        migrations.CreateModel(
            name='ReceivedAdviceNote',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('batch_no', models.CharField(max_length=25, unique=True)),
                ('prepared_on', models.DateField(blank=True, null=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('status', river.models.fields.state.StateField(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='river.State')),
            ],
            options={
                'ordering': ('batch_no',),
            },
        ),
        migrations.CreateModel(
            name='ReceivedNote',
            fields=[
                ('material_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='raw_materials_dept.Material')),
                ('batch_no', models.CharField(max_length=25, unique=True)),
                ('date_prepared', models.DateField(blank=True, null=True)),
                ('stock_received', models.PositiveIntegerField(blank=True)),
                ('approved', models.BooleanField(default=False)),
                ('remarks', models.CharField(blank=True, max_length=50)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('status', river.models.fields.state.StateField(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='river.State')),
            ],
            options={
                'ordering': ('batch_no',),
            },
            bases=('raw_materials_dept.material',),
        ),
        migrations.AddField(
            model_name='material',
            name='manufacturer',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='raw_materials_dept.Manufacturer'),
        ),
        migrations.AddField(
            model_name='material',
            name='recieved_advice_note',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='receivedadvicenote', to='raw_materials_dept.ReceivedAdviceNote'),
        ),
        migrations.AddField(
            model_name='material',
            name='recieved_note',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='receivednote', to='raw_materials_dept.ReceivedNote'),
        ),
    ]
