# Generated by Django 2.2.12 on 2020-06-01 20:49

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("contenttypes", "0002_remove_content_type_name"),
        ("treasury", "__first__"),
    ]

    operations = [
        migrations.CreateModel(
            name="Expense",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "creation_date",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        verbose_name="creation date and time",
                    ),
                ),
                (
                    "lastmod",
                    models.DateTimeField(
                        db_index=True, verbose_name="last modification"
                    ),
                ),
                (
                    "slug",
                    models.SlugField(
                        blank=True,
                        help_text="For fast recall",
                        unique=True,
                        verbose_name="refer code",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        db_index=True, max_length=255, unique=True, verbose_name="name"
                    ),
                ),
                (
                    "notes",
                    models.TextField(blank=True, null=True, verbose_name="notes"),
                ),
                (
                    "lastmod_user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="expense_expense_lastmod_related",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="last modification by",
                    ),
                ),
                (
                    "owner",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="expense_expense_related",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="owner",
                    ),
                ),
                (
                    "polymorphic_ctype",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="polymorphic_expense.expense_set+",
                        to="contenttypes.ContentType",
                    ),
                ),
            ],
            options={
                "verbose_name": "Expense",
                "verbose_name_plural": "Expenses",
            },
            bases=(erp_framework.base.models.DiffingMixin, models.Model),
        ),
        migrations.CreateModel(
            name="ExpenseTransaction",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("slug", models.SlugField(blank=True, verbose_name="refer code")),
                ("date", models.DateTimeField(db_index=True, verbose_name="date")),
                ("type", models.CharField(db_index=True, max_length=30)),
                (
                    "notes",
                    models.TextField(blank=True, null=True, verbose_name="notes"),
                ),
                (
                    "value",
                    models.DecimalField(
                        decimal_places=2, default=0, max_digits=19, verbose_name="value"
                    ),
                ),
                (
                    "creation_date",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        verbose_name="creation date and time",
                    ),
                ),
                (
                    "lastmod",
                    models.DateTimeField(
                        db_index=True, verbose_name="last modification"
                    ),
                ),
                (
                    "expense",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="expense.Expense",
                        verbose_name="Expense",
                    ),
                ),
                (
                    "lastmod_user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="expense_expensetransaction_lastmod_related",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="last modification by",
                    ),
                ),
                (
                    "owner",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="expense_expensetransaction_related",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="owner",
                    ),
                ),
                (
                    "polymorphic_ctype",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="polymorphic_expense.expensetransaction_set+",
                        to="contenttypes.ContentType",
                    ),
                ),
                (
                    "treasury",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="treasury.Treasury",
                        verbose_name="Treasury",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
            bases=(erp_framework.base.models.DiffingMixin, models.Model),
        ),
    ]
