# Generated by Django 3.2 on 2021-05-05 00:32

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 = [
        ('farsys', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('account', models.CharField(max_length=30)),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='farsys.account')),
            ],
        ),
        migrations.CreateModel(
            name='Client',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cliente', models.CharField(max_length=30)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='farsys.account')),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=30)),
                ('presentacion', models.CharField(blank=True, max_length=30, null=True)),
                ('price_unit', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=6, null=True)),
                ('price_tira', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=6, null=True)),
                ('price_box', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=6, null=True)),
                ('tira_units', models.IntegerField(blank=True, default=0, null=True)),
                ('box_units', models.IntegerField(blank=True, default=0, null=True)),
                ('stock', models.IntegerField(blank=True, default=0, null=True)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='farsys.account')),
                ('categoria', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='farsys.category')),
            ],
        ),
        migrations.CreateModel(
            name='Purchase',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('fecha', models.DateField(default=django.utils.timezone.now)),
                ('total', models.DecimalField(decimal_places=2, max_digits=6)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='farsys.account')),
            ],
        ),
        migrations.CreateModel(
            name='Sale',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('fecha', models.DateField(default=django.utils.timezone.now)),
                ('total', models.DecimalField(decimal_places=2, max_digits=6)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='farsys.account')),
                ('cliente', models.ForeignKey(default='1', on_delete=django.db.models.deletion.PROTECT, related_name='invoices', to='farsys.client')),
            ],
        ),
        migrations.CreateModel(
            name='Vendor',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('proveedor', models.CharField(max_length=30)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='farsys.account')),
            ],
        ),
        migrations.CreateModel(
            name='Sucursal',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sucursal', models.CharField(max_length=30)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='farsys.account')),
            ],
        ),
        migrations.CreateModel(
            name='SaleItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cantidad', models.IntegerField()),
                ('unidad', models.CharField(max_length=15)),
                ('precio', models.DecimalField(decimal_places=2, max_digits=6)),
                ('total', models.DecimalField(decimal_places=2, max_digits=6)),
                ('orden', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='order_items', to='farsys.sale')),
                ('producto', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='farsys.product')),
            ],
        ),
        migrations.AddField(
            model_name='sale',
            name='sucursal',
            field=models.ForeignKey(default='1', on_delete=django.db.models.deletion.PROTECT, to='farsys.sucursal'),
        ),
        migrations.CreateModel(
            name='PurchaseItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cantidad', models.IntegerField()),
                ('unidad', models.CharField(max_length=15)),
                ('precio', models.DecimalField(decimal_places=2, max_digits=6)),
                ('total', models.DecimalField(decimal_places=2, max_digits=6)),
                ('orden', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='order_items', to='farsys.purchase')),
                ('producto', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='farsys.product')),
            ],
        ),
        migrations.AddField(
            model_name='purchase',
            name='proveedor',
            field=models.ForeignKey(default='1', on_delete=django.db.models.deletion.PROTECT, related_name='invoices', to='farsys.vendor'),
        ),
        migrations.AddField(
            model_name='purchase',
            name='sucursal',
            field=models.ForeignKey(default='1', on_delete=django.db.models.deletion.PROTECT, to='farsys.sucursal'),
        ),
        migrations.CreateModel(
            name='Match',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='farsys.account')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='account', to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
