gestioCOF/kfet/migrations/0001_initial.py

714 lines
25 KiB
Python
Raw Normal View History

2016-08-02 10:40:46 +02:00
# -*- 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
2016-08-02 10:40:46 +02:00
class Migration(migrations.Migration):
dependencies = [("gestioncof", "0007_alter_club")]
2016-08-02 10:40:46 +02:00
operations = [
migrations.CreateModel(
name="Account",
2016-08-02 10:40:46 +02:00
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",
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="AccountNegative",
2016-08-02 10:40:46 +02:00
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",
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="Article",
2016-08-02 10:40:46 +02:00
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)),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="ArticleCategory",
2016-08-02 10:40:46 +02:00
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=45)),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="ArticleRule",
2016-08-02 10:40:46 +02:00
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",
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="Checkout",
2016-08-02 10:40:46 +02:00
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",
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="CheckoutTransfer",
2016-08-02 10:40:46 +02:00
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",
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="Inventory",
2016-08-02 10:40:46 +02:00
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("at", models.DateTimeField(auto_now_add=True)),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="InventoryArticle",
2016-08-02 10:40:46 +02:00
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"
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="Operation",
2016-08-02 10:40:46 +02:00
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,
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="OperationGroup",
2016-08-02 10:40:46 +02:00
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,
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="Order",
2016-08-02 10:40:46 +02:00
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)),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="OrderArticle",
2016-08-02 10:40:46 +02:00
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"
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="Statement",
2016-08-02 10:40:46 +02:00
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",
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="Supplier",
2016-08-02 10:40:46 +02:00
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()),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="SupplierArticle",
2016-08-02 10:40:46 +02:00
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"
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="Transfer",
2016-08-02 10:40:46 +02:00
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",
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.CreateModel(
name="TransferGroup",
2016-08-02 10:40:46 +02:00
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,
),
),
2016-08-02 10:40:46 +02:00
],
),
migrations.AddField(
model_name="transfer",
name="group",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="transfers",
to="kfet.TransferGroup",
),
2016-08-02 10:40:46 +02:00
),
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",
),
2016-08-02 10:40:46 +02:00
),
migrations.AddField(
model_name="supplier",
name="articles",
field=models.ManyToManyField(
related_name="suppliers",
through="kfet.SupplierArticle",
to="kfet.Article",
),
2016-08-02 10:40:46 +02:00
),
migrations.AddField(
model_name="order",
name="articles",
field=models.ManyToManyField(
related_name="orders", through="kfet.OrderArticle", to="kfet.Article"
),
2016-08-02 10:40:46 +02:00
),
migrations.AddField(
model_name="order",
name="supplier",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="orders",
to="kfet.Supplier",
),
2016-08-02 10:40:46 +02:00
),
migrations.AddField(
model_name="operation",
name="group",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="kfet.OperationGroup",
),
2016-08-02 10:40:46 +02:00
),
migrations.AddField(
model_name="inventory",
name="articles",
field=models.ManyToManyField(
related_name="inventories",
through="kfet.InventoryArticle",
to="kfet.Article",
),
2016-08-02 10:40:46 +02:00
),
migrations.AddField(
model_name="inventory",
name="by",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="kfet.Account",
),
2016-08-02 10:40:46 +02:00
),
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,
),
2016-08-02 10:40:46 +02:00
),
migrations.AddField(
model_name="article",
name="category",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="articles",
to="kfet.ArticleCategory",
),
2016-08-02 10:40:46 +02:00
),
]