# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-10-27 05:45
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    dependencies = [
        ('back_office', 'load_initial_data'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('inventories', 'load_initial_data'),
    ]

    operations = [
        migrations.CreateModel(
            name='ProductTransferReception',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_received', models.DateTimeField(default=django.utils.timezone.now, verbose_name='fecha de recepción')),
                ('date_confirmed', models.DateTimeField(blank=True, editable=False, null=True, verbose_name='fecha de confirmación')),
                ('status', models.PositiveSmallIntegerField(choices=[(0, 'Confirmada'), (1, 'Cancelada'), (2, 'Pendiente')], default=2, verbose_name='estado')),
                ('confirmed_by_user', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='confirmed_product_receptions', to=settings.AUTH_USER_MODEL, verbose_name='confirmado por')),
            ],
            options={
                'verbose_name': 'recepción de transferencia de producto',
                'verbose_name_plural': 'recepciones de transferencias de productos',
            },
        ),
        migrations.CreateModel(
            name='ProductTransferShipment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_shipped', models.DateTimeField(default=django.utils.timezone.now, verbose_name='fecha de envío')),
                ('date_confirmed', models.DateTimeField(blank=True, editable=False, null=True, verbose_name='fecha de confirmación')),
                ('status', models.PositiveSmallIntegerField(choices=[(0, 'Confirmado'), (1, 'Cancelado'), (2, 'Pendiente'), (3, 'Recibido'), (4, 'Rechazado')], default=2, verbose_name='estado')),
                ('confirmed_by_user', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='confirmed_product_transfers', to=settings.AUTH_USER_MODEL, verbose_name='confirmado por')),
                ('shipped_by_user', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='shipped_product_transfers', to=settings.AUTH_USER_MODEL, verbose_name='enviado por')),
                ('source_branch', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='product_transfers_as_source_branch', to='back_office.BranchOffice', verbose_name='sucursal de origen')),
                ('target_branch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='product_transfers_as_target_branch', to='back_office.BranchOffice', verbose_name='sucursal de destino')),
            ],
            options={
                'verbose_name': 'envío de transferencia de productos',
                'verbose_name_plural': 'envíos de transferencia de productos',
            },
        ),
        migrations.CreateModel(
            name='ReceivedProduct',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('received_quantity', models.PositiveSmallIntegerField(default=1, verbose_name='cantidad recibida')),
                ('accepted_quantity', models.PositiveSmallIntegerField(default=1, verbose_name='cantidad aceptada')),
                ('rejection_reason', models.PositiveSmallIntegerField(blank=True, choices=[(0, 'La cantidad recibida no concuerda con la esperada.'), (1, 'El material recibido no concuerda con el esperado.'), (1, 'El material se encuentra en mal estado.')], null=True, verbose_name='motivo de rechazo')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='inventories.Product', verbose_name='producto')),
                ('product_transfer_reception', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventories.ProductTransferReception', verbose_name='recepción')),
            ],
            options={
                'verbose_name': 'producto recibido',
                'verbose_name_plural': 'productos recibidos',
            },
        ),
        migrations.CreateModel(
            name='TransferredProduct',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveSmallIntegerField(default=1, verbose_name='cantidad')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='inventories.Product', verbose_name='producto')),
                ('product_transfer_shipment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventories.ProductTransferShipment', verbose_name='envío')),
            ],
            options={
                'verbose_name': 'producto transferido',
                'verbose_name_plural': 'productos transferidos',
            },
        ),
        migrations.RemoveField(
            model_name='producttransfer',
            name='product',
        ),
        migrations.RemoveField(
            model_name='producttransfer',
            name='source_branch',
        ),
        migrations.RemoveField(
            model_name='producttransfer',
            name='target_branch',
        ),
        migrations.RemoveField(
            model_name='productentry',
            name='date',
        ),
        migrations.RemoveField(
            model_name='productremoval',
            name='date',
        ),
        migrations.RemoveField(
            model_name='productremoval',
            name='product_transfer',
        ),
        migrations.RemoveField(
            model_name='productremoval',
            name='user',
        ),
        migrations.RemoveField(
            model_name='purchaseorder',
            name='date',
        ),
        migrations.AddField(
            model_name='productentry',
            name='confirmed_by_user',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='confirmed_product_entries', to=settings.AUTH_USER_MODEL, verbose_name='confirmado por'),
        ),
        migrations.AddField(
            model_name='productentry',
            name='date_confirmed',
            field=models.DateTimeField(blank=True, editable=False, null=True, verbose_name='fecha de confirmación'),
        ),
        migrations.AddField(
            model_name='productentry',
            name='date_entered',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='fecha de envío'),
        ),
        migrations.AddField(
            model_name='productentry',
            name='entered_by_user',
            field=models.ForeignKey(default=1, editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='entered_product_entries', to=settings.AUTH_USER_MODEL, verbose_name='Ingresado por'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='productremoval',
            name='confirmed_by_user',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='confirmed_product_removals', to=settings.AUTH_USER_MODEL, verbose_name='confirmado por'),
        ),
        migrations.AddField(
            model_name='productremoval',
            name='date_confirmed',
            field=models.DateTimeField(blank=True, editable=False, null=True, verbose_name='fecha de confirmación'),
        ),
        migrations.AddField(
            model_name='productremoval',
            name='date_removed',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='fecha'),
        ),
        migrations.AddField(
            model_name='productremoval',
            name='removed_by_user',
            field=models.ForeignKey(default=1, editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='removed_product_removals', to=settings.AUTH_USER_MODEL, verbose_name='Creada por'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='purchaseorder',
            name='are_products_received',
            field=models.BooleanField(default=False, editable=False, verbose_name='se han recibido los productos'),
        ),
        migrations.AddField(
            model_name='purchaseorder',
            name='confirmed_by_user',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='purchase_orders_confirmed', to=settings.AUTH_USER_MODEL, verbose_name='confirmado por'),
        ),
        migrations.AddField(
            model_name='purchaseorder',
            name='date_confirmed',
            field=models.DateTimeField(blank=True, editable=False, null=True, verbose_name='fecha de confirmación'),
        ),
        migrations.AddField(
            model_name='purchaseorder',
            name='date_purchased',
            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='fecha de compra'),
        ),
        migrations.AddField(
            model_name='purchaseorder',
            name='purchased_by_user',
            field=models.ForeignKey(default=1, editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='purchase_orders_purchased', to=settings.AUTH_USER_MODEL, verbose_name='solicitado por'),
            preserve_default=False,
        ),
        migrations.DeleteModel(
            name='ProductTransfer',
        ),
        migrations.AddField(
            model_name='producttransferreception',
            name='product_transfer_shipment',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventories.ProductTransferShipment', verbose_name='transferencia'),
        ),
        migrations.AddField(
            model_name='producttransferreception',
            name='received_by_user',
            field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='received_product_transfers', to=settings.AUTH_USER_MODEL, verbose_name='recibido por'),
        ),
        migrations.AddField(
            model_name='productremoval',
            name='product_transfer_reception',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='inventories.ProductTransferReception', verbose_name='recepción de transferencia de producto'),
        ),
    ]
