# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-30 08:01
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('currency_history', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('slug', models.SlugField(max_length=128)),
                ('initial_amount', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('total_amount', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='accounts', to='currency_history.Currency')),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Invoice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('invoice_type', models.CharField(choices=[(b'w', b'withdrawal'), (b'd', b'deposit')], max_length=1)),
                ('invoice_date', models.DateField()),
                ('invoice_number', models.CharField(blank=True, max_length=256)),
                ('description', models.TextField(blank=True)),
                ('amount_net', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10)),
                ('vat', models.DecimalField(decimal_places=2, default=0, max_digits=4)),
                ('amount_gross', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10)),
                ('value_net', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('value_gross', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('payment_date', models.DateField(blank=True, null=True)),
                ('pdf', models.FileField(blank=True, null=True, upload_to=b'invoice_files')),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invoices', to='currency_history.Currency')),
            ],
            options={
                'ordering': ['-invoice_date'],
            },
            bases=(account_keeping.models.AmountMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Payee',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('transaction_type', models.CharField(choices=[(b'w', b'withdrawal'), (b'd', b'deposit')], max_length=1)),
                ('transaction_date', models.DateField()),
                ('description', models.TextField(blank=True)),
                ('invoice_number', models.CharField(blank=True, max_length=256)),
                ('amount_net', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10)),
                ('vat', models.DecimalField(decimal_places=2, default=0, max_digits=4)),
                ('amount_gross', models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10)),
                ('value_net', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('value_gross', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='account_keeping.Account')),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='account_keeping.Category')),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='currency_history.Currency')),
                ('invoice', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='account_keeping.Invoice')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='account_keeping.Transaction')),
                ('payee', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='account_keeping.Payee')),
            ],
            options={
                'ordering': ['-transaction_date'],
            },
            bases=(account_keeping.models.AmountMixin, models.Model),
        ),
    ]
