gestioCOF/kfet/migrations/0001_initial.py
2018-10-06 13:15:33 +02:00

713 lines
25 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("gestioncof", "0007_alter_club")]
operations = [
migrations.CreateModel(
name="Account",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"trigramme",
models.CharField(
max_length=3,
validators=[
django.core.validators.RegexValidator(regex="^[^a-z]{3}$")
],
unique=True,
),
),
(
"balance",
models.DecimalField(decimal_places=2, default=0, max_digits=6),
),
("frozen", models.BooleanField(default=False)),
(
"promo",
models.IntegerField(
null=True,
blank=True,
choices=[
(1980, 1980),
(1981, 1981),
(1982, 1982),
(1983, 1983),
(1984, 1984),
(1985, 1985),
(1986, 1986),
(1987, 1987),
(1988, 1988),
(1989, 1989),
(1990, 1990),
(1991, 1991),
(1992, 1992),
(1993, 1993),
(1994, 1994),
(1995, 1995),
(1996, 1996),
(1997, 1997),
(1998, 1998),
(1999, 1999),
(2000, 2000),
(2001, 2001),
(2002, 2002),
(2003, 2003),
(2004, 2004),
(2005, 2005),
(2006, 2006),
(2007, 2007),
(2008, 2008),
(2009, 2009),
(2010, 2010),
(2011, 2011),
(2012, 2012),
(2013, 2013),
(2014, 2014),
(2015, 2015),
(2016, 2016),
],
default=2015,
),
),
("nickname", models.CharField(max_length=255, blank=True, default="")),
(
"password",
models.CharField(
max_length=255, blank=True, null=True, unique=True, default=None
),
),
(
"cofprofile",
models.OneToOneField(
on_delete=django.db.models.deletion.PROTECT,
related_name="account_kfet",
to="gestioncof.CofProfile",
),
),
],
),
migrations.CreateModel(
name="AccountNegative",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"start",
models.DateTimeField(
default=datetime.datetime(2016, 8, 2, 10, 22, 1, 569492)
),
),
("balance_offset", models.DecimalField(decimal_places=2, max_digits=6)),
(
"authorized_overdraft",
models.DecimalField(decimal_places=2, default=0, max_digits=6),
),
("comment", models.CharField(max_length=255, blank=True)),
(
"account",
models.OneToOneField(
on_delete=django.db.models.deletion.PROTECT,
related_name="negative",
to="kfet.Account",
),
),
],
),
migrations.CreateModel(
name="Article",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=45)),
("is_sold", models.BooleanField(default=True)),
("price", models.DecimalField(decimal_places=2, max_digits=6)),
("stock", models.IntegerField(default=0)),
],
),
migrations.CreateModel(
name="ArticleCategory",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=45)),
],
),
migrations.CreateModel(
name="ArticleRule",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("ratio", models.PositiveSmallIntegerField()),
(
"article_on",
models.OneToOneField(
on_delete=django.db.models.deletion.PROTECT,
related_name="rule_on",
to="kfet.Article",
),
),
(
"article_to",
models.OneToOneField(
on_delete=django.db.models.deletion.PROTECT,
related_name="rule_to",
to="kfet.Article",
),
),
],
),
migrations.CreateModel(
name="Checkout",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=45)),
("valid_from", models.DateTimeField()),
("valid_to", models.DateTimeField()),
("balance", models.DecimalField(decimal_places=2, max_digits=6)),
("is_protected", models.BooleanField(default=False)),
(
"created_by",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="kfet.Account",
),
),
],
),
migrations.CreateModel(
name="CheckoutTransfer",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("amount", models.DecimalField(decimal_places=2, max_digits=6)),
(
"from_checkout",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="transfers_from",
to="kfet.Checkout",
),
),
(
"to_checkout",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="transfers_to",
to="kfet.Checkout",
),
),
],
),
migrations.CreateModel(
name="Inventory",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("at", models.DateTimeField(auto_now_add=True)),
],
),
migrations.CreateModel(
name="InventoryArticle",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("stock_old", models.IntegerField()),
("stock_new", models.IntegerField()),
("stock_error", models.IntegerField(default=0)),
(
"article",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT, to="kfet.Article"
),
),
(
"inventory",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT, to="kfet.Inventory"
),
),
],
),
migrations.CreateModel(
name="Operation",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.CharField(
max_length=8,
choices=[
("purchase", "Achat"),
("deposit", "Charge"),
("withdraw", "Retrait"),
],
),
),
("amount", models.DecimalField(decimal_places=2, max_digits=6)),
("on_checkout", models.BooleanField(default=True)),
(
"canceled_at",
models.DateTimeField(blank=True, null=True, default=None),
),
("addcost_amount", models.DecimalField(decimal_places=2, max_digits=6)),
(
"addcost_for",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
blank=True,
related_name="addcosts",
to="kfet.Account",
null=True,
default=None,
),
),
(
"article",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
blank=True,
related_name="operations",
to="kfet.Article",
null=True,
default=None,
),
),
(
"canceled_by",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
blank=True,
related_name="+",
to="kfet.Account",
null=True,
default=None,
),
),
],
),
migrations.CreateModel(
name="OperationGroup",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("at", models.DateTimeField(auto_now_add=True)),
("amount", models.IntegerField()),
("is_cof", models.BooleanField(default=False)),
("comment", models.CharField(max_length=255, blank=True, default="")),
(
"checkout",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="operations",
to="kfet.Checkout",
),
),
(
"on_acc",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="operations",
to="kfet.Account",
),
),
(
"valid_by",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
blank=True,
related_name="+",
to="kfet.Account",
null=True,
default=True,
),
),
],
),
migrations.CreateModel(
name="Order",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("at", models.DateTimeField(auto_now_add=True)),
("amount", models.DecimalField(decimal_places=2, max_digits=6)),
],
),
migrations.CreateModel(
name="OrderArticle",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("quantity_ordered", models.IntegerField()),
("quantity_received", models.IntegerField()),
(
"article",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT, to="kfet.Article"
),
),
(
"order",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT, to="kfet.Order"
),
),
],
),
migrations.CreateModel(
name="Statement",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("balance_old", models.DecimalField(decimal_places=2, max_digits=6)),
("balance_new", models.DecimalField(decimal_places=2, max_digits=6)),
("amount_taken", models.DecimalField(decimal_places=2, max_digits=6)),
("amount_error", models.DecimalField(decimal_places=2, max_digits=6)),
("at", models.DateTimeField(auto_now_add=True)),
(
"by",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="kfet.Account",
),
),
(
"checkout",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="statements",
to="kfet.Checkout",
),
),
],
),
migrations.CreateModel(
name="Supplier",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=45)),
("address", models.TextField()),
("email", models.EmailField(max_length=254)),
("phone", models.CharField(max_length=10)),
("comment", models.TextField()),
],
),
migrations.CreateModel(
name="SupplierArticle",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"box_type",
models.CharField(
max_length=7,
choices=[
("caisse", "Caisse"),
("carton", "Carton"),
("palette", "Palette"),
("fût", "Fût"),
],
),
),
("box_capacity", models.PositiveSmallIntegerField()),
("price_HT", models.DecimalField(decimal_places=4, max_digits=7)),
("TVA", models.DecimalField(decimal_places=2, max_digits=4)),
("rights", models.DecimalField(decimal_places=4, max_digits=7)),
(
"article",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT, to="kfet.Article"
),
),
(
"supplier",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT, to="kfet.Supplier"
),
),
],
),
migrations.CreateModel(
name="Transfer",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("amount", models.DecimalField(decimal_places=2, max_digits=6)),
(
"canceled_at",
models.DateTimeField(blank=True, null=True, default=None),
),
(
"canceled_by",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
blank=True,
related_name="+",
to="kfet.Account",
null=True,
default=None,
),
),
(
"from_acc",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="transfers_from",
to="kfet.Account",
),
),
],
),
migrations.CreateModel(
name="TransferGroup",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("at", models.DateTimeField(auto_now_add=True)),
("comment", models.CharField(max_length=255, blank=True, default="")),
(
"valid_by",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
blank=True,
related_name="+",
to="kfet.Account",
null=True,
default=None,
),
),
],
),
migrations.AddField(
model_name="transfer",
name="group",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="transfers",
to="kfet.TransferGroup",
),
),
migrations.AddField(
model_name="transfer",
name="to_acc",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="transfers_to",
to="kfet.Account",
),
),
migrations.AddField(
model_name="supplier",
name="articles",
field=models.ManyToManyField(
related_name="suppliers",
through="kfet.SupplierArticle",
to="kfet.Article",
),
),
migrations.AddField(
model_name="order",
name="articles",
field=models.ManyToManyField(
related_name="orders", through="kfet.OrderArticle", to="kfet.Article"
),
),
migrations.AddField(
model_name="order",
name="supplier",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="orders",
to="kfet.Supplier",
),
),
migrations.AddField(
model_name="operation",
name="group",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="kfet.OperationGroup",
),
),
migrations.AddField(
model_name="inventory",
name="articles",
field=models.ManyToManyField(
related_name="inventories",
through="kfet.InventoryArticle",
to="kfet.Article",
),
),
migrations.AddField(
model_name="inventory",
name="by",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="kfet.Account",
),
),
migrations.AddField(
model_name="inventory",
name="order",
field=models.OneToOneField(
on_delete=django.db.models.deletion.PROTECT,
blank=True,
related_name="inventory",
to="kfet.Order",
null=True,
default=None,
),
),
migrations.AddField(
model_name="article",
name="category",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="articles",
to="kfet.ArticleCategory",
),
),
]