0001_initial.py 5.34 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
Skia's avatar
Skia committed
5
import accounting.models
Skia's avatar
Skia committed
6
7
8
9
10


class Migration(migrations.Migration):

    dependencies = [
Skia's avatar
Skia committed
11
12
        ('core', '0001_initial'),
        ('club', '0001_initial'),
Skia's avatar
Skia committed
13
14
15
    ]

    operations = [
Skia's avatar
Skia committed
16
17
18
        migrations.CreateModel(
            name='AccountingType',
            fields=[
Skia's avatar
Skia committed
19
20
21
22
                ('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
                ('code', models.CharField(verbose_name='code', max_length=16)),
                ('label', models.CharField(verbose_name='label', max_length=60)),
                ('movement_type', models.CharField(verbose_name='movement type', choices=[('credit', 'Credit'), ('debit', 'Debit'), ('neutral', 'Neutral')], max_length=12)),
Skia's avatar
Skia committed
23
            ],
Skia's avatar
Skia committed
24
25
26
            options={
                'verbose_name': 'accounting type',
            },
Skia's avatar
Skia committed
27
        ),
28
29
30
        migrations.CreateModel(
            name='BankAccount',
            fields=[
Skia's avatar
Skia committed
31
32
33
34
35
                ('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
                ('name', models.CharField(verbose_name='name', max_length=30)),
                ('iban', models.CharField(blank=True, verbose_name='iban', max_length=255)),
                ('number', models.CharField(blank=True, verbose_name='account number', max_length=255)),
                ('club', models.ForeignKey(related_name='bank_accounts', to='club.Club')),
36
37
38
39
40
            ],
        ),
        migrations.CreateModel(
            name='ClubAccount',
            fields=[
Skia's avatar
Skia committed
41
42
43
44
                ('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
                ('name', models.CharField(verbose_name='name', max_length=30)),
                ('bank_account', models.ForeignKey(related_name='club_accounts', to='accounting.BankAccount')),
                ('club', models.OneToOneField(related_name='club_account', to='club.Club')),
45
46
            ],
        ),
Skia's avatar
Skia committed
47
48
49
50
51
52
53
54
55
56
        migrations.CreateModel(
            name='Company',
            fields=[
                ('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
                ('name', models.CharField(verbose_name='name', max_length=60)),
            ],
            options={
                'verbose_name': 'company',
            },
        ),
Skia's avatar
Skia committed
57
58
59
        migrations.CreateModel(
            name='GeneralJournal',
            fields=[
Skia's avatar
Skia committed
60
                ('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
Skia's avatar
Skia committed
61
                ('start_date', models.DateField(verbose_name='start date')),
Skia's avatar
Skia committed
62
63
64
65
66
67
                ('end_date', models.DateField(default=None, null=True, verbose_name='end date', blank=True)),
                ('name', models.CharField(verbose_name='name', max_length=30)),
                ('closed', models.BooleanField(default=False, verbose_name='is closed')),
                ('amount', accounting.models.CurrencyField(default=0, decimal_places=2, max_digits=12, verbose_name='amount')),
                ('effective_amount', accounting.models.CurrencyField(default=0, decimal_places=2, max_digits=12, verbose_name='effective_amount')),
                ('club_account', models.ForeignKey(related_name='journals', to='accounting.ClubAccount')),
Skia's avatar
Skia committed
68
69
70
            ],
        ),
        migrations.CreateModel(
71
            name='Operation',
Skia's avatar
Skia committed
72
            fields=[
Skia's avatar
Skia committed
73
74
75
                ('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
                ('number', models.IntegerField(verbose_name='number')),
                ('amount', accounting.models.CurrencyField(decimal_places=2, max_digits=12, verbose_name='amount')),
Skia's avatar
Skia committed
76
                ('date', models.DateField(verbose_name='date')),
Skia's avatar
Skia committed
77
78
79
80
81
82
83
84
85
86
87
                ('label', models.CharField(verbose_name='label', max_length=50)),
                ('remark', models.TextField(verbose_name='remark', max_length=255)),
                ('mode', models.CharField(verbose_name='payment method', choices=[('CHEQUE', 'Check'), ('CASH', 'Cash'), ('TRANSFert', 'Transfert'), ('CARD', 'Credit card')], max_length=255)),
                ('cheque_number', models.IntegerField(default=-1, verbose_name='cheque number')),
                ('done', models.BooleanField(default=False, verbose_name='is done')),
                ('target_type', models.CharField(verbose_name='target type', choices=[('USER', 'User'), ('CLUB', 'Club'), ('ACCOUNT', 'Account'), ('COMPANY', 'Company'), ('OTHER', 'Other')], max_length=10)),
                ('target_id', models.IntegerField(null=True, verbose_name='target id', blank=True)),
                ('target_label', models.CharField(default='', blank=True, verbose_name='target label', max_length=32)),
                ('accounting_type', models.ForeignKey(verbose_name='accounting type', related_name='operations', to='accounting.AccountingType')),
                ('invoice', models.ForeignKey(verbose_name='invoice', related_name='operations', blank=True, null=True, to='core.SithFile')),
                ('journal', models.ForeignKey(related_name='operations', to='accounting.GeneralJournal')),
Skia's avatar
Skia committed
88
            ],
Skia's avatar
Skia committed
89
90
91
92
93
94
95
            options={
                'ordering': ['-number'],
            },
        ),
        migrations.AlterUniqueTogether(
            name='operation',
            unique_together=set([('number', 'journal')]),
Skia's avatar
Skia committed
96
97
        ),
    ]