# Generated by Django 2.2.4 on 2019-08-06 15:18

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('people', '0003_auto_20190806_1516'),
        ('common', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='BudgetDoc',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('document', models.FileField(upload_to='documents/%Y/%m/%d')),
                ('year', models.IntegerField(verbose_name='Year')),
            ],
            options={
                'verbose_name': 'Budget document',
            },
        ),
        migrations.CreateModel(
            name='CostCenter',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='Name')),
                ('code', models.CharField(max_length=200, verbose_name='Code')),
                ('start_date', models.DateField(blank=True, null=True)),
                ('end_date', models.DateField(blank=True, null=True)),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='people.Group', verbose_name='Group')),
            ],
            options={
                'verbose_name': 'Finance Cost Center',
                'verbose_name_plural': 'Finance Cost Centers',
                'ordering': ['code'],
            },
        ),
        migrations.CreateModel(
            name='FinancingAgency',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='Name')),
            ],
            options={
                'verbose_name': 'Financing agency',
                'verbose_name_plural': 'Financing agencies',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Grant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='Name')),
            ],
            options={
                'verbose_name': 'Grant',
                'verbose_name_plural': 'Grants',
            },
        ),
        migrations.CreateModel(
            name='Grantdomain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('domain', models.CharField(max_length=200, verbose_name='Grant domain')),
            ],
            options={
                'verbose_name': 'Grant domain',
                'verbose_name_plural': 'Grant domains',
            },
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='Name')),
                ('code', models.CharField(max_length=200, unique=True, verbose_name='Code')),
                ('start_date', models.DateField(blank=True, help_text='Starting date of the grant', null=True, verbose_name='Starting date')),
                ('end_date', models.DateField(blank=True, help_text='Ending date of the grant', null=True, verbose_name='Ending date')),
                ('total_amount', models.DecimalField(blank=True, decimal_places=2, help_text='Total amount of the grant', max_digits=11, null=True, verbose_name='Total amount')),
                ('overheads', models.DecimalField(blank=True, decimal_places=2, help_text='Overhead amount of the grant', max_digits=11, null=True, verbose_name='Overhead')),
                ('funding', models.DecimalField(blank=True, decimal_places=2, help_text='Funding amount of the grant', max_digits=11, null=True, verbose_name='Funding')),
                ('costcenter', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.CostCenter', verbose_name='Cost Center')),
                ('currency', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='common.Currency', verbose_name='Currency')),
                ('grant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='finance.Grant', verbose_name='Grant')),
                ('responsible', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='people.Person')),
            ],
            options={
                'verbose_name': 'Finance Project',
                'verbose_name_plural': 'Finance Projects',
                'ordering': ['code', 'costcenter'],
            },
        ),
        migrations.AddField(
            model_name='grant',
            name='domain',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.Grantdomain', verbose_name='Grant domain'),
        ),
        migrations.AddField(
            model_name='grant',
            name='grantor',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.FinancingAgency', verbose_name='Grantor'),
        ),
        migrations.AddField(
            model_name='grant',
            name='nationality',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='common.Nationality', verbose_name='Grant nationality'),
        ),
        migrations.CreateModel(
            name='ExpenseCode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.CharField(max_length=100, verbose_name='ExpenseCode Number')),
                ('type', models.CharField(max_length=100, verbose_name='ExpenseCode Type')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.Project', verbose_name='Finance project')),
            ],
            options={
                'verbose_name': 'Expense code',
                'verbose_name_plural': 'Expense codes',
                'unique_together': {('number', 'project')},
            },
        ),
        migrations.CreateModel(
            name='Budget',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=11, verbose_name='Amount (NET)')),
                ('year', models.IntegerField(blank=True, null=True, verbose_name='Year')),
                ('expensecode', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.ExpenseCode', verbose_name='Expense Code')),
            ],
            options={
                'verbose_name': 'Budget',
                'verbose_name_plural': 'Budgets',
                'unique_together': {('year', 'expensecode')},
            },
        ),
    ]
