# Generated by Django 2.2.6 on 2019-10-26 14:19

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


class Migration(migrations.Migration):

    dependencies = [("shop", "0016_auto_20191024_1457")]

    operations = [
        migrations.CreateModel(
            name="Invoice",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("date", models.DateField(blank=True, null=True)),
                (
                    "number",
                    models.CharField(blank=True, max_length=10, null=True, unique=True),
                ),
                (
                    "total",
                    models.DecimalField(
                        blank=True, decimal_places=2, max_digits=10, null=True
                    ),
                ),
                ("paid", models.BooleanField(default=False)),
                (
                    "buyer",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="shop.Contact",
                    ),
                ),
            ],
        ),
        migrations.RenameField(
            model_name="purchase", old_name="purchase_date", new_name="date"
        ),
        migrations.RenameField(
            model_name="purchaseexpense",
            old_name="expense_type",
            new_name="description",
        ),
        migrations.AddField(
            model_name="purchase",
            name="vat",
            field=models.DecimalField(
                blank=True, decimal_places=2, max_digits=10, null=True
            ),
        ),
        migrations.CreateModel(
            name="InvoiceExtra",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("description", models.CharField(max_length=20)),
                (
                    "amount",
                    models.DecimalField(
                        blank=True, decimal_places=2, max_digits=10, null=True
                    ),
                ),
                (
                    "invoice",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="shop.Invoice"
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="item",
            name="invoice",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="shop.Invoice",
            ),
        ),
    ]
