# Generated by Django 2.1.7 on 2020-05-22 17:57

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('product', '0004_auto_20200511_1642'),
        ('company', '0029_auto_20200520_1847'),
    ]

    operations = [
        migrations.CreateModel(
            name='AgentOrderBatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ancestor_id', models.IntegerField(db_index=True, verbose_name='族系')),
                ('code', models.CharField(max_length=20, verbose_name='订单号')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='下单时间')),
                ('dt_expect', models.DateField(verbose_name='期望到货日期')),
                ('tm_complete', models.DateTimeField(blank=True, null=True, verbose_name='订单完成时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='agentorder_batch_company', to='company.Company', verbose_name='下单公司')),
                ('receiver', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='agentorder_batch_receiver', to='company.Company', verbose_name='接单公司')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='agentorder_batch_user', to=settings.AUTH_USER_MODEL, verbose_name='下单人')),
            ],
            options={
                'verbose_name': '终端店订单Batch',
                'verbose_name_plural': '终端店订单Batch',
            },
        ),
        migrations.CreateModel(
            name='AgentOrderDetails',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ancestor_id', models.IntegerField(blank=True, db_index=True, null=True, verbose_name='族系')),
                ('qty', models.IntegerField(verbose_name='数量')),
                ('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='company.AgentOrderBatch', verbose_name='终端店订单Batch')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='agentlorder_detail_company', to='company.Company', verbose_name='公司')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='agentorder_detail_product', to='product.Product', verbose_name='产品名称')),
                ('receiver', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='agentorder_detail_receiver', to='company.Company', verbose_name='接单公司')),
            ],
            options={
                'verbose_name': '终端店订单detail',
                'verbose_name_plural': '终端店订单detail',
            },
        ),
        migrations.AddField(
            model_name='terminalregister',
            name='license_number',
            field=models.CharField(blank=True, max_length=50, null=True, verbose_name='营业执照编号'),
        ),
        migrations.AlterUniqueTogether(
            name='agentorderbatch',
            unique_together={('company', 'code')},
        ),
    ]
