# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-05-08 22:10
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('delivery', '0001_initial'),
        ('nomenclature', '0001_initial'),
        ('order', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='ArticleStore',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='Номер')),
                ('cnt', models.FloatField(blank=True, null=True, verbose_name='Налично кол.')),
                ('cnt_min', models.FloatField(blank=True, null=True, verbose_name='Минимално кол.')),
                ('cnt_bl', models.FloatField(blank=True, null=True, verbose_name='Блокирано кол.')),
                ('note', models.TextField(blank=True, max_length=1000, verbose_name='Забележка за блокировката')),
                ('article_fk', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='nomenclature.Article', verbose_name='Артикул')),
                ('club_fk', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='nomenclature.Club', verbose_name='Клуб')),
            ],
            options={
                'managed': True,
                'verbose_name': 'Складова наличност',
                'verbose_name_plural': 'Складови наличности',
                'db_table': 'article_store',
            },
        ),
        migrations.CreateModel(
            name='stock_acceptance_detail',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='Номер')),
                ('cnt', models.FloatField(verbose_name='Количество')),
                ('article_store_fk', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='store.ArticleStore', verbose_name='Артикул')),
                ('deliverydetail_fk', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='delivery.DeliveryDetail', verbose_name='Доставено кол.')),
            ],
            options={
                'managed': True,
                'verbose_name': 'Приемане на стока',
                'verbose_name_plural': 'Приемане на стоки',
                'db_table': 'stock_acceptance_detail',
            },
        ),
        migrations.CreateModel(
            name='stock_delivery_detail',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='Номер')),
                ('cnt', models.FloatField(verbose_name='Количество')),
                ('article_store_fk', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='store.ArticleStore', verbose_name='Артикул')),
                ('orderdetail_fk', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='order.OrderDetail', verbose_name='Поръчка детайл')),
            ],
            options={
                'managed': True,
                'verbose_name': 'Издаване на стока',
                'verbose_name_plural': 'Издаване на стоки',
                'db_table': 'stock_delivery_detail',
            },
        ),
        migrations.CreateModel(
            name='stock_receipt_protocol',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='Номер')),
                ('receipt_date', models.DateField(blank=True, default=django.utils.timezone.now, null=True, verbose_name='Дата')),
                ('type', models.CharField(choices=[('REVISION', 'ППП Ревизия'), ('ORDER', 'ППП Продажба'), ('DELIVERY', 'ППП Доставка'), ('EXPDELIVERY', 'ППП Доставка чрез експедиция'), ('CORDELIVERY', 'ППП Корекция доставка'), ('EXPEDITION', 'ППП Експедиция'), ('LATEORD', 'ППП Късно изписване'), ('INTERNAL', 'ППП Вътрешни нужди'), ('SCRAP', 'ППП Брак')], default='REVISION', max_length=40, verbose_name='Тип на протокола')),
                ('closed', models.BooleanField(default=False, verbose_name='Приключен')),
                ('note', models.TextField(blank=True, max_length=2000, null=True, verbose_name='Забележка')),
                ('club_fk', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='nomenclature.Club', verbose_name='Обект')),
                ('delivery_fk', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='delivery.Delivery', verbose_name='Доставка')),
                ('order_fk', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='order.Order', verbose_name='Поръчка')),
                ('transfer_club_fk', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='stock_receipt_protocol_transfer_set', to='nomenclature.Club', verbose_name='Към обект')),
                ('transfer_fk', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='store.stock_receipt_protocol', verbose_name='Трансфер')),
            ],
            options={
                'managed': True,
                'verbose_name': 'Приемо Предавателен Протокол',
                'verbose_name_plural': 'Приемо Предавателни Протоколи',
                'db_table': 'stock_receipt_protocol',
            },
        ),
        migrations.AddField(
            model_name='stock_delivery_detail',
            name='stock_protocol_fk',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='store.stock_receipt_protocol', verbose_name='Протокол'),
        ),
        migrations.AddField(
            model_name='stock_acceptance_detail',
            name='stock_protocol_fk',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='store.stock_receipt_protocol', verbose_name='Протокол'),
        ),
    ]
