Sith/accounting/migrations/0001_initial.py

282 lines
9.7 KiB
Python
Raw Normal View History

2016-01-28 15:53:37 +00:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
2016-04-20 01:30:49 +00:00
import accounting.models
import django.db.models.deletion
2016-01-28 15:53:37 +00:00
class Migration(migrations.Migration):
2018-10-04 19:29:19 +00:00
dependencies = []
2016-01-28 15:53:37 +00:00
operations = [
2016-04-20 01:30:49 +00:00
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="AccountingType",
2016-04-20 01:30:49 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"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",
),
),
2016-04-20 01:30:49 +00:00
],
2016-08-10 11:52:57 +00:00
options={
2018-10-04 19:29:19 +00:00
"verbose_name": "accounting type",
"ordering": ["movement_type", "code"],
2016-08-10 11:52:57 +00:00
},
2016-04-20 01:30:49 +00:00
),
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="BankAccount",
fields=[
2018-10-04 19:29:19 +00:00
(
"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"
),
),
],
2018-10-04 19:29:19 +00:00
options={"verbose_name": "Bank account", "ordering": ["club", "name"]},
),
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="ClubAccount",
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
serialize=False,
verbose_name="ID",
auto_created=True,
),
),
("name", models.CharField(max_length=30, verbose_name="name")),
],
options={
2018-10-04 19:29:19 +00:00
"verbose_name": "Club account",
"ordering": ["bank_account", "name"],
},
),
2016-08-10 11:52:57 +00:00
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="Company",
2016-08-10 11:52:57 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
serialize=False,
verbose_name="ID",
auto_created=True,
),
),
("name", models.CharField(max_length=60, verbose_name="name")),
2016-08-10 11:52:57 +00:00
],
2018-10-04 19:29:19 +00:00
options={"verbose_name": "company"},
2016-08-10 11:52:57 +00:00
),
2016-01-28 15:53:37 +00:00
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="GeneralJournal",
2016-01-28 15:53:37 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"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,
),
),
2016-01-28 15:53:37 +00:00
],
2018-10-04 19:29:19 +00:00
options={"verbose_name": "General journal", "ordering": ["-start_date"]},
2016-01-28 15:53:37 +00:00
),
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="Operation",
2016-01-28 15:53:37 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"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,
on_delete=django.db.models.deletion.CASCADE,
2018-10-04 19:29:19 +00:00
),
),
2016-01-28 15:53:37 +00:00
],
2018-10-04 19:29:19 +00:00
options={"ordering": ["-number"]},
2016-08-10 11:52:57 +00:00
),
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="SimplifiedAccountingType",
fields=[
2018-10-04 19:29:19 +00:00
(
"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",
on_delete=django.db.models.deletion.CASCADE,
2018-10-04 19:29:19 +00:00
),
),
],
options={
2018-10-04 19:29:19 +00:00
"verbose_name": "simplified type",
"ordering": ["accounting_type__movement_type", "accounting_type__code"],
},
2016-01-28 15:53:37 +00:00
),
]