# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-10-21 04:49
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):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('back_office', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Consumable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=45, verbose_name='nombre')),
                ('description', models.CharField(blank=True, max_length=50, verbose_name='descripción')),
                ('image', models.ImageField(blank=True, upload_to='', verbose_name='imagen')),
                ('brand', models.CharField(max_length=45, verbose_name='marca')),
                ('model', models.CharField(max_length=45, verbose_name='modelo')),
                ('prefix', models.SmallIntegerField(choices=[(0, 'N/A'), (-24, 'y'), (-21, 'z'), (-18, 'a'), (-15, 'f'), (-12, 'p'), (-9, 'n'), (-6, 'μ'), (-3, 'm'), (-2, 'c'), (-1, 'd'), (1, 'da'), (2, 'h'), (3, 'k'), (6, 'M'), (9, 'G'), (12, 'T'), (15, 'P'), (18, 'E'), (21, 'Z'), (24, 'Y')], default=0, verbose_name='prefijo de unidad')),
                ('unit', models.PositiveSmallIntegerField(choices=[(0, 'N/A'), (1, 'm'), (2, 'in'), (3, 'ft'), (4, 'yd'), (5, 'mi'), (6, 'g'), (7, 's'), (8, 'pz'), (9, 'l')], default=0, verbose_name='unidad')),
            ],
            options={
                'verbose_name': 'consumible',
                'verbose_name_plural': 'consumibles',
            },
        ),
        migrations.CreateModel(
            name='ConsumableInventoryItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=0, verbose_name='cantidad')),
            ],
            options={
                'verbose_name': 'elemento de inventario de consumibles',
                'verbose_name_plural': 'elementos de inventario de consumibles',
            },
        ),
        migrations.CreateModel(
            name='ConsumablesInventory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=45, verbose_name='nombre')),
                ('last_update', models.DateTimeField(auto_now=True, verbose_name='última actualización')),
            ],
            options={
                'verbose_name': 'inventario de consumibles',
                'verbose_name_plural': 'inventarios de consumibles',
            },
        ),
        migrations.CreateModel(
            name='DurableGood',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=45, verbose_name='nombre')),
                ('description', models.CharField(max_length=50, verbose_name='descripción')),
                ('image', models.ImageField(blank=True, upload_to='', verbose_name='imagen')),
                ('brand', models.CharField(max_length=45, verbose_name='marca')),
                ('model', models.CharField(max_length=45, verbose_name='modelo')),
                ('prefix', models.SmallIntegerField(choices=[(0, 'N/A'), (-24, 'y'), (-21, 'z'), (-18, 'a'), (-15, 'f'), (-12, 'p'), (-9, 'n'), (-6, 'μ'), (-3, 'm'), (-2, 'c'), (-1, 'd'), (1, 'da'), (2, 'h'), (3, 'k'), (6, 'M'), (9, 'G'), (12, 'T'), (15, 'P'), (18, 'E'), (21, 'Z'), (24, 'Y')], default=0, verbose_name='prefijo de la unidad')),
                ('unit', models.PositiveSmallIntegerField(choices=[(0, 'N/A'), (1, 'm'), (2, 'in'), (3, 'ft'), (4, 'yd'), (5, 'mi'), (6, 'g'), (7, 's'), (8, 'pz'), (9, 'l')], default=0, verbose_name='unidad')),
            ],
            options={
                'verbose_name': 'activo',
                'verbose_name_plural': 'activos',
            },
        ),
        migrations.CreateModel(
            name='DurableGoodInventoryItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=0, verbose_name='cantidad')),
            ],
            options={
                'verbose_name': 'elemento de inventario de activos',
                'verbose_name_plural': 'elementos de inventarios de activos',
            },
        ),
        migrations.CreateModel(
            name='DurableGoodsInventory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=45, verbose_name='nombre')),
                ('last_update', models.DateTimeField(auto_now=True, verbose_name='última actualización')),
            ],
            options={
                'verbose_name': 'inventario de activos',
                'verbose_name_plural': 'inventarios de activos',
            },
        ),
        migrations.CreateModel(
            name='EnteredProduct',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveSmallIntegerField(default=1, verbose_name='cantidad')),
            ],
            options={
                'verbose_name': 'producto ingresado',
                'verbose_name_plural': 'productos ingresados',
            },
        ),
        migrations.CreateModel(
            name='Material',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=45, verbose_name='nombre')),
                ('description', models.CharField(max_length=50, verbose_name='descripción')),
                ('image', models.FileField(blank=True, upload_to='', verbose_name='imagen')),
                ('color', models.CharField(default='color', max_length=10)),
                ('length', models.DecimalField(decimal_places=2, default=0.01, max_digits=6, verbose_name='longitud')),
                ('width', models.DecimalField(decimal_places=2, default=0.01, max_digits=6, verbose_name='anchura')),
                ('thickness', models.DecimalField(decimal_places=2, default=0.01, max_digits=6, verbose_name='grosor')),
                ('weight', models.DecimalField(decimal_places=2, default=0.01, max_digits=6, verbose_name='peso')),
                ('prefix', models.SmallIntegerField(blank=True, choices=[(0, 'N/A'), (-24, 'y'), (-21, 'z'), (-18, 'a'), (-15, 'f'), (-12, 'p'), (-9, 'n'), (-6, 'μ'), (-3, 'm'), (-2, 'c'), (-1, 'd'), (1, 'da'), (2, 'h'), (3, 'k'), (6, 'M'), (9, 'G'), (12, 'T'), (15, 'P'), (18, 'E'), (21, 'Z'), (24, 'Y')], default=0, verbose_name='prefijo de unidad')),
                ('unit', models.PositiveSmallIntegerField(choices=[(0, 'N/A'), (1, 'm'), (2, 'in'), (3, 'ft'), (4, 'yd'), (5, 'mi'), (6, 'g'), (7, 's'), (8, 'pz'), (9, 'l')], default=0, verbose_name='unidad')),
            ],
            options={
                'verbose_name': 'material',
                'verbose_name_plural': 'materiales',
            },
        ),
        migrations.CreateModel(
            name='MaterialInventoryItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=0, verbose_name='cantidad')),
            ],
            options={
                'verbose_name': 'elemento de inventario de materiales',
                'verbose_name_plural': 'elementos de inventario de materiales',
            },
        ),
        migrations.CreateModel(
            name='MaterialsInventory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=45, verbose_name='nombre')),
                ('last_update', models.DateTimeField(auto_now=True, verbose_name='última actualización')),
            ],
            options={
                'verbose_name': 'inventario de materiales',
                'verbose_name_plural': 'inventarios de materiales',
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sku', models.CharField(max_length=45, unique=True, verbose_name='SKU')),
                ('description', models.CharField(max_length=100, verbose_name='descripción')),
                ('search_description', models.CharField(max_length=100, verbose_name='descripción para búsqueda')),
                ('line', models.PositiveSmallIntegerField(choices=[(0, 'ACR'), (1, 'ACRILETA'), (2, 'ACRIMP'), (3, 'ACRIP'), (4, 'ADE'), (5, 'DIFUSOR'), (6, 'DOM'), (7, 'GLASLINER'), (8, 'LAM'), (9, 'OTROS'), (10, 'PERFIL'), (11, 'PLA'), (12, 'POL'), (13, 'POL_SOL'), (14, 'SILI'), (15, 'STON')], default=9, verbose_name='línea')),
                ('engraving', models.CharField(blank=True, max_length=45, verbose_name='grabado')),
                ('color', models.CharField(blank=True, max_length=20, verbose_name='color')),
                ('length', models.DecimalField(decimal_places=2, default=0, max_digits=6, verbose_name='longitud (m)')),
                ('width', models.DecimalField(decimal_places=2, default=0, max_digits=6, verbose_name='anchura (m)')),
                ('thickness', models.DecimalField(decimal_places=2, default=0, max_digits=6, verbose_name='espesor (mm)')),
                ('is_composite', models.BooleanField(default=False, verbose_name='es compuesto')),
                ('is_scrap', models.BooleanField(default=False, editable=False, verbose_name='es pedacería')),
            ],
            options={
                'verbose_name': 'producto',
                'verbose_name_plural': 'productos',
            },
        ),
        migrations.CreateModel(
            name='ProductComponent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=45, verbose_name='nombre')),
                ('required_units', models.PositiveSmallIntegerField(default=1, verbose_name='unidades requeridas del componente')),
                ('required_amount_per_unit', models.DecimalField(decimal_places=2, default=1.0, max_digits=5, verbose_name='cantidad requerida por unidad')),
            ],
            options={
                'verbose_name': 'componente de un producto',
                'verbose_name_plural': 'componentes de productos',
            },
        ),
        migrations.CreateModel(
            name='ProductEntry',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now_add=True, verbose_name='fecha')),
                ('status', models.PositiveSmallIntegerField(choices=[(0, 'Confirmado'), (1, 'Cancelado'), (2, 'Pendiente')], default=2, verbose_name='estado')),
            ],
            options={
                'verbose_name': 'ingreso de producto',
                'verbose_name_plural': 'ingresos de producto',
            },
        ),
        migrations.CreateModel(
            name='ProductInventoryItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=0, verbose_name='cantidad')),
            ],
            options={
                'verbose_name': 'elemento de inventario de productos',
                'verbose_name_plural': 'elementos de inventario de productos',
            },
        ),
        migrations.CreateModel(
            name='ProductReimbursement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField(default=django.utils.timezone.now, verbose_name='fecha de devolución')),
                ('monetary_difference', models.DecimalField(decimal_places=2, default=0.0, max_digits=10, verbose_name='diferencia')),
            ],
            options={
                'verbose_name': 'devolución de productos',
                'verbose_name_plural': 'devoluciones de productos',
            },
        ),
        migrations.CreateModel(
            name='ProductRemoval',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cause', models.PositiveSmallIntegerField(choices=[(0, 'Interna'), (1, 'Proveedor'), (2, 'Transferencia')], default=0, verbose_name='causa')),
                ('date', models.DateTimeField(auto_now_add=True, verbose_name='fecha')),
                ('status', models.PositiveSmallIntegerField(choices=[(0, 'Confirmada'), (1, 'Cancelada'), (2, 'Pendiente')], default=2, verbose_name='estado')),
            ],
            options={
                'verbose_name': 'merma de producto',
                'verbose_name_plural': 'mermas de producto',
            },
        ),
        migrations.CreateModel(
            name='ProductsInventory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=45, verbose_name='nombre')),
                ('last_update', models.DateTimeField(auto_now=True, verbose_name='última actualización')),
                ('branch', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='back_office.BranchOffice', verbose_name='sucursal')),
                ('last_updater', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='autor de la última actualización')),
                ('supervisor', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='products_inventories_supervised', to=settings.AUTH_USER_MODEL, verbose_name='supervisor')),
            ],
            options={
                'verbose_name': 'inventario de productos',
                'verbose_name_plural': 'inventarios de productos',
            },
        ),
        migrations.CreateModel(
            name='ProductTransfer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=1, verbose_name='cantidad')),
                ('confirmed_quantity', models.PositiveIntegerField(default=1, verbose_name='cantidad confirmada')),
                ('is_confirmed', models.BooleanField(default=False, verbose_name='confirmada')),
                ('transfer_has_been_made', models.BooleanField(default=False, editable=False)),
                ('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')),
                ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='fecha de creación')),
                ('date_reviewed', models.DateTimeField(blank=True, editable=False, null=True, verbose_name='fecha de revisión')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventories.Product', verbose_name='producto')),
                ('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': 'transferencia de productos',
                'verbose_name_plural': 'transferencias de productos',
            },
        ),
        migrations.CreateModel(
            name='PurchasedProduct',
            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')),
            ],
            options={
                'verbose_name': 'producto comprado',
                'verbose_name_plural': 'productos comprados',
            },
        ),
        migrations.CreateModel(
            name='PurchaseOrder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now_add=True, verbose_name='fecha')),
                ('invoice_folio', models.CharField(max_length=30, verbose_name='folio factura')),
                ('status', models.PositiveSmallIntegerField(choices=[(0, 'Confirmado'), (1, 'Cancelado'), (2, 'Pendiente')], default=2, verbose_name='estado')),
                ('branch_office', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='back_office.BranchOffice', verbose_name='sucursal')),
                ('provider', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='back_office.Provider', verbose_name='proveedor')),
            ],
            options={
                'verbose_name': 'orden de compra',
                'verbose_name_plural': 'órdenes de compra',
            },
        ),
        migrations.CreateModel(
            name='RemovedProduct',
            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_removal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventories.ProductRemoval', verbose_name='salida')),
            ],
            options={
                'verbose_name': 'producto retirado',
                'verbose_name_plural': 'productos retirados',
            },
        ),
        migrations.CreateModel(
            name='ReturnedProduct',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=1, verbose_name='cantidad')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventories.Product', verbose_name='producto')),
                ('reimbursement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventories.ProductReimbursement', verbose_name='devolución')),
            ],
            options={
                'verbose_name': 'producto devuelto (entra)',
                'verbose_name_plural': 'productos devueltos (entran)',
            },
        ),
        migrations.AddField(
            model_name='purchasedproduct',
            name='purchase_order',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventories.PurchaseOrder', verbose_name='orden de compra'),
        ),
        migrations.AddField(
            model_name='productremoval',
            name='inventory',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='inventories.ProductsInventory', verbose_name='inventario'),
        ),
        migrations.AddField(
            model_name='productremoval',
            name='product_transfer',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='inventories.ProductTransfer', verbose_name='transferencia de producto'),
        ),
        migrations.AddField(
            model_name='productremoval',
            name='provider',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='back_office.Provider', verbose_name='proveedor'),
        ),
        migrations.AddField(
            model_name='productremoval',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='usuario'),
        ),
        migrations.AddField(
            model_name='productreimbursement',
            name='inventory',
            field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, to='inventories.ProductsInventory', verbose_name='inventario'),
        ),
    ]
