# Generated by Django 2.2 on 2020-08-24 16:24

from decimal import Decimal
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='FamiliaRepuesto',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=50, unique=True)),
                ('descripcion', models.CharField(max_length=100, null=True)),
            ],
            options={
                'verbose_name': 'Familia de repuesto',
                'verbose_name_plural': 'Familias de repuestos',
            },
        ),
        migrations.CreateModel(
            name='Repuesto',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('codigo', models.CharField(max_length=20, unique=True)),
                ('nombre', models.CharField(max_length=50, unique=True)),
                ('costo', models.DecimalField(decimal_places=2, default=0, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))])),
                ('familia', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='reparaciones.FamiliaRepuesto')),
            ],
            options={
                'verbose_name': 'Repuesto',
                'verbose_name_plural': 'Repuestos',
            },
        ),
        migrations.CreateModel(
            name='Presupuesto',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('asunto', models.CharField(max_length=100)),
                ('fecha', models.DateField(auto_now_add=True)),
                ('tasa_cambio', models.DecimalField(decimal_places=2, default=1.0, max_digits=10)),
                ('oc_autorizacion', models.FileField(blank=True, help_text='Se agrega al obtener la OC o aprobación del cliente.', null=True, upload_to='oc_autoriz/presupuestos/', verbose_name='OC - Aprobacion')),
                ('facturado', models.BooleanField(default=False)),
                ('cliente', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.Cliente')),
                ('moneda', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='data.Moneda')),
                ('usuario', models.ForeignKey(default=1, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Presupuesto',
                'verbose_name_plural': 'Presupuestos',
            },
        ),
        migrations.CreateModel(
            name='LineaPresupuesto',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cantidad', models.PositiveIntegerField(default=1)),
                ('costo_custom', models.DecimalField(decimal_places=2, default=0, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0.00'))])),
                ('presupuesto', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='reparaciones.Presupuesto')),
                ('repuesto', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reparaciones.Repuesto')),
            ],
            options={
                'verbose_name': 'Items en presupuesto',
                'verbose_name_plural': 'Items en presupuestos',
            },
        ),
    ]
