summaryrefslogtreecommitdiff
path: root/postgresqleu/accounting/migrations/0001_initial.py
blob: b3d63e7572ab0495489bf147d21184555ea80642 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import postgresqleu.accounting.models


class Migration(migrations.Migration):

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('num', models.IntegerField(unique=True, verbose_name='Account number')),
                ('name', models.CharField(max_length=100)),
                ('availableforinvoicing', models.BooleanField(default=False, verbose_name='Available for invoicing', help_text='List this account in the dropdown when creating a manual invoice')),
                ('objectrequirement', models.IntegerField(default=0, verbose_name='Object required', choices=[(0, 'Optional'), (1, 'Required'), (2, 'Forbidden')], help_text='Require an object to be specified when using this account')),
            ],
            options={
                'ordering': ('num',),
            },
        ),
        migrations.CreateModel(
            name='AccountClass',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
                ('inbalance', models.BooleanField(default=False, verbose_name='In balance', help_text='Is this account class listed in the balance report (instead of results report)')),
                ('balancenegative', models.BooleanField(default=False, verbose_name='Balance negative', help_text='Should the sign of the balance of this account be reversed in the report')),
            ],
            options={
                'ordering': ('name',),
                'verbose_name': 'Account class',
                'verbose_name_plural': 'Account classes',
            },
        ),
        migrations.CreateModel(
            name='AccountGroup',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
                ('foldable', models.BooleanField(default=False, help_text='If this account is alone in the group having values, fold it into a single line and rmeove the group header/footer')),
                ('accountclass', models.ForeignKey(default=False, to='accounting.AccountClass', on_delete=models.CASCADE, verbose_name='Account class')),
            ],
            options={
                'ordering': ('name',),
            },
        ),
        migrations.CreateModel(
            name='IncomingBalance',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('amount', models.DecimalField(max_digits=10, decimal_places=2, validators=[postgresqleu.accounting.models.nonzero_validator])),
                ('account', models.ForeignKey(to='accounting.Account', to_field='num', on_delete=models.CASCADE)),
            ],
            options={
                'ordering': ('year__pk', 'account'),
            },
        ),
        migrations.CreateModel(
            name='JournalEntry',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('seq', models.IntegerField()),
                ('date', models.DateField()),
                ('closed', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='JournalItem',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('amount', models.DecimalField(max_digits=10, decimal_places=2, validators=[postgresqleu.accounting.models.nonzero_validator])),
                ('description', models.CharField(max_length=200)),
                ('account', models.ForeignKey(to='accounting.Account', to_field='num', on_delete=models.CASCADE)),
                ('journal', models.ForeignKey(to='accounting.JournalEntry', on_delete=models.CASCADE)),
            ],
        ),
        migrations.CreateModel(
            name='JournalUrl',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('url', models.URLField()),
                ('journal', models.ForeignKey(to='accounting.JournalEntry', on_delete=models.CASCADE)),
            ],
        ),
        migrations.CreateModel(
            name='Object',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=30)),
                ('active', models.BooleanField(default=True)),
            ],
            options={
                'ordering': ('name',),
                'verbose_name': 'Accounting object'
            },
        ),
        migrations.CreateModel(
            name='Year',
            fields=[
                ('year', models.IntegerField(serialize=False, primary_key=True)),
                ('isopen', models.BooleanField()),
            ],
            options={
                'ordering': ('-year',),
            },
        ),
        migrations.AddField(
            model_name='journalitem',
            name='object',
            field=models.ForeignKey(blank=True, to='accounting.Object', null=True, on_delete=models.CASCADE),
        ),
        migrations.AddField(
            model_name='journalentry',
            name='year',
            field=models.ForeignKey(to='accounting.Year', on_delete=models.CASCADE),
        ),
        migrations.AddField(
            model_name='incomingbalance',
            name='year',
            field=models.ForeignKey(to='accounting.Year', on_delete=models.CASCADE),
        ),
        migrations.AddField(
            model_name='account',
            name='group',
            field=models.ForeignKey(to='accounting.AccountGroup', on_delete=models.CASCADE),
        ),
        migrations.AlterUniqueTogether(
            name='journalentry',
            unique_together=set([('year', 'seq')]),
        ),
        migrations.AlterUniqueTogether(
            name='incomingbalance',
            unique_together=set([('year', 'account')]),
        ),
    ]