0001_initial.py 9.69 KB
Newer Older
Skia's avatar
Skia committed
1
2
3
4
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
5
import django.core.validators
Skia's avatar
Skia committed
6
import accounting.models
7
import django.db.models.deletion
Skia's avatar
Skia committed
8
9
10
11


class Migration(migrations.Migration):

Sli's avatar
Sli committed
12
    dependencies = []
Skia's avatar
Skia committed
13
14

    operations = [
Skia's avatar
Skia committed
15
        migrations.CreateModel(
Sli's avatar
Sli committed
16
            name="AccountingType",
Skia's avatar
Skia committed
17
            fields=[
Sli's avatar
Sli committed
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
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                (
                    "code",
                    models.CharField(
                        max_length=16,
                        verbose_name="code",
                        validators=[
                            django.core.validators.RegexValidator(
                                "^[0-9]*$",
                                "An accounting type code contains only numbers",
                            )
                        ],
                    ),
                ),
                ("label", models.CharField(max_length=128, verbose_name="label")),
                (
                    "movement_type",
                    models.CharField(
                        choices=[
                            ("CREDIT", "Credit"),
                            ("DEBIT", "Debit"),
                            ("NEUTRAL", "Neutral"),
                        ],
                        max_length=12,
                        verbose_name="movement type",
                    ),
                ),
Skia's avatar
Skia committed
53
            ],
Skia's avatar
Skia committed
54
            options={
Sli's avatar
Sli committed
55
56
                "verbose_name": "accounting type",
                "ordering": ["movement_type", "code"],
Skia's avatar
Skia committed
57
            },
Skia's avatar
Skia committed
58
        ),
59
        migrations.CreateModel(
Sli's avatar
Sli committed
60
            name="BankAccount",
61
            fields=[
Sli's avatar
Sli committed
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("name", models.CharField(max_length=30, verbose_name="name")),
                (
                    "iban",
                    models.CharField(max_length=255, blank=True, verbose_name="iban"),
                ),
                (
                    "number",
                    models.CharField(
                        max_length=255, blank=True, verbose_name="account number"
                    ),
                ),
82
            ],
Sli's avatar
Sli committed
83
            options={"verbose_name": "Bank account", "ordering": ["club", "name"]},
84
85
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
86
            name="ClubAccount",
87
            fields=[
Sli's avatar
Sli committed
88
89
90
91
92
93
94
95
96
97
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("name", models.CharField(max_length=30, verbose_name="name")),
98
            ],
99
            options={
Sli's avatar
Sli committed
100
101
                "verbose_name": "Club account",
                "ordering": ["bank_account", "name"],
102
            },
103
        ),
Skia's avatar
Skia committed
104
        migrations.CreateModel(
Sli's avatar
Sli committed
105
            name="Company",
Skia's avatar
Skia committed
106
            fields=[
Sli's avatar
Sli committed
107
108
109
110
111
112
113
114
115
116
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("name", models.CharField(max_length=60, verbose_name="name")),
Skia's avatar
Skia committed
117
            ],
Sli's avatar
Sli committed
118
            options={"verbose_name": "company"},
Skia's avatar
Skia committed
119
        ),
Skia's avatar
Skia committed
120
        migrations.CreateModel(
Sli's avatar
Sli committed
121
            name="GeneralJournal",
Skia's avatar
Skia committed
122
            fields=[
Sli's avatar
Sli committed
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("start_date", models.DateField(verbose_name="start date")),
                (
                    "end_date",
                    models.DateField(
                        null=True, verbose_name="end date", default=None, blank=True
                    ),
                ),
                ("name", models.CharField(max_length=40, verbose_name="name")),
                (
                    "closed",
                    models.BooleanField(verbose_name="is closed", default=False),
                ),
                (
                    "amount",
                    accounting.models.CurrencyField(
                        decimal_places=2,
                        default=0,
                        verbose_name="amount",
                        max_digits=12,
                    ),
                ),
                (
                    "effective_amount",
                    accounting.models.CurrencyField(
                        decimal_places=2,
                        default=0,
                        verbose_name="effective_amount",
                        max_digits=12,
                    ),
                ),
Skia's avatar
Skia committed
162
            ],
Sli's avatar
Sli committed
163
            options={"verbose_name": "General journal", "ordering": ["-start_date"]},
Skia's avatar
Skia committed
164
165
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
166
            name="Operation",
Skia's avatar
Skia committed
167
            fields=[
Sli's avatar
Sli committed
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("number", models.IntegerField(verbose_name="number")),
                (
                    "amount",
                    accounting.models.CurrencyField(
                        decimal_places=2, max_digits=12, verbose_name="amount"
                    ),
                ),
                ("date", models.DateField(verbose_name="date")),
                ("remark", models.CharField(max_length=128, verbose_name="comment")),
                (
                    "mode",
                    models.CharField(
                        choices=[
                            ("CHECK", "Check"),
                            ("CASH", "Cash"),
                            ("TRANSFERT", "Transfert"),
                            ("CARD", "Credit card"),
                        ],
                        max_length=255,
                        verbose_name="payment method",
                    ),
                ),
                (
                    "cheque_number",
                    models.CharField(
                        max_length=32,
                        null=True,
                        verbose_name="cheque number",
                        default="",
                        blank=True,
                    ),
                ),
                ("done", models.BooleanField(verbose_name="is done", default=False)),
                (
                    "target_type",
                    models.CharField(
                        choices=[
                            ("USER", "User"),
                            ("CLUB", "Club"),
                            ("ACCOUNT", "Account"),
                            ("COMPANY", "Company"),
                            ("OTHER", "Other"),
                        ],
                        max_length=10,
                        verbose_name="target type",
                    ),
                ),
                (
                    "target_id",
                    models.IntegerField(
                        null=True, verbose_name="target id", blank=True
                    ),
                ),
                (
                    "target_label",
                    models.CharField(
                        max_length=32,
                        blank=True,
                        verbose_name="target label",
                        default="",
                    ),
                ),
                (
                    "accounting_type",
                    models.ForeignKey(
                        null=True,
                        related_name="operations",
                        verbose_name="accounting type",
                        to="accounting.AccountingType",
                        blank=True,
247
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
248
249
                    ),
                ),
Skia's avatar
Skia committed
250
            ],
Sli's avatar
Sli committed
251
            options={"ordering": ["-number"]},
Skia's avatar
Skia committed
252
        ),
253
        migrations.CreateModel(
Sli's avatar
Sli committed
254
            name="SimplifiedAccountingType",
255
            fields=[
Sli's avatar
Sli committed
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("label", models.CharField(max_length=128, verbose_name="label")),
                (
                    "accounting_type",
                    models.ForeignKey(
                        verbose_name="simplified accounting types",
                        to="accounting.AccountingType",
                        related_name="simplified_types",
272
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
273
274
                    ),
                ),
275
276
            ],
            options={
Sli's avatar
Sli committed
277
278
                "verbose_name": "simplified type",
                "ordering": ["accounting_type__movement_type", "accounting_type__code"],
279
            },
Skia's avatar
Skia committed
280
281
        ),
    ]