8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 19:33:11 +00:00
re2o/cotisations/migrations/0001_model_creation.py

553 lines
20 KiB
Python
Raw Normal View History

2020-12-28 13:31:08 +00:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.core.validators
import re2o.mixins
import re2o.aes_field
import re2o.field_permissions
import cotisations.models
import cotisations.payment_methods.mixins
class Migration(migrations.Migration):
initial = True
dependencies = []
2020-12-28 13:31:08 +00:00
operations = [
migrations.CreateModel(
name="BaseInvoice",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("date", models.DateTimeField(auto_now_add=True, verbose_name="date")),
2020-12-28 13:31:08 +00:00
],
bases=(
re2o.mixins.RevMixin,
re2o.mixins.AclMixin,
re2o.field_permissions.FieldPermissionModelMixin,
models.Model,
),
),
migrations.CreateModel(
name="Facture",
fields=[
(
"baseinvoice_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="cotisations.BaseInvoice",
),
),
(
"cheque",
models.CharField(
max_length=255, blank=True, verbose_name="cheque number"
),
),
("valid", models.BooleanField(default=False, verbose_name="validated")),
(
"control",
models.BooleanField(default=False, verbose_name="controlled"),
),
],
options={
"permissions": (
("change_facture_control", 'Can edit the "controlled" state'),
("view_facture", "Can view an invoice object"),
("change_all_facture", "Can edit all the previous invoices"),
),
"verbose_name": "invoice",
"verbose_name_plural": "invoices",
},
),
migrations.CreateModel(
name="CustomInvoice",
fields=[
(
"baseinvoice_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="cotisations.BaseInvoice",
),
),
(
"recipient",
models.CharField(max_length=255, verbose_name="recipient"),
2020-12-28 13:31:08 +00:00
),
(
"payment",
models.CharField(max_length=255, verbose_name="payment type"),
2020-12-28 13:31:08 +00:00
),
("address", models.CharField(max_length=255, verbose_name="address")),
("paid", models.BooleanField(default=False, verbose_name="paid")),
2020-12-28 13:31:08 +00:00
(
"remark",
models.TextField(verbose_name="remark", blank=True, null=True),
),
],
bases=("cotisations.baseinvoice",),
options={
"permissions": (
("view_custominvoice", "Can view a custom invoice object"),
)
2020-12-28 13:31:08 +00:00
},
),
migrations.CreateModel(
name="CostEstimate",
fields=[
(
"custominvoice_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="cotisations.CustomInvoice",
),
),
(
"validity",
models.DurationField(
verbose_name="period of validity", help_text="DD HH:MM:SS"
2020-12-28 13:31:08 +00:00
),
),
],
options={
"permissions": (
("view_costestimate", "Can view a cost estimate object"),
)
},
bases=("cotisations.custominvoice",),
),
migrations.CreateModel(
name="Vente",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"number",
models.IntegerField(
validators=[django.core.validators.MinValueValidator(1)],
verbose_name="amount",
),
),
("name", models.CharField(max_length=255, verbose_name="article")),
(
"prix",
models.DecimalField(
max_digits=5, decimal_places=2, verbose_name="price"
),
),
(
"duration_connection",
models.PositiveIntegerField(
default=0, verbose_name="duration of the connection (in months)"
),
),
(
"duration_days_connection",
models.PositiveIntegerField(
default=0,
verbose_name="duration of the connection (in days, will be added to duration in months)",
),
),
(
"duration_membership",
models.PositiveIntegerField(
default=0, verbose_name="duration of the membership (in months)"
),
),
(
"duration_days_membership",
models.PositiveIntegerField(
default=0,
verbose_name="duration of the membership (in days, will be added to duration in months)",
),
),
],
bases=(
re2o.mixins.RevMixin,
re2o.mixins.AclMixin,
models.Model,
),
options={
"permissions": (
("view_vente", "Can view a purchase object"),
("change_all_vente", "Can edit all the previous purchases"),
),
"verbose_name": "purchase",
"verbose_name_plural": "purchases",
},
),
migrations.CreateModel(
name="Article",
bases=(
re2o.mixins.RevMixin,
re2o.mixins.AclMixin,
models.Model,
),
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(max_length=255, verbose_name="designation"),
),
(
"prix",
models.DecimalField(
max_digits=5, decimal_places=2, verbose_name="unit price"
),
),
(
"duration_connection",
models.PositiveIntegerField(
verbose_name="duration of the connection (in months)"
2020-12-28 13:31:08 +00:00
),
),
(
"duration_days_connection",
models.PositiveIntegerField(
verbose_name="duration of the connection (in days, will be added to duration in months)",
),
),
(
"duration_membership",
models.PositiveIntegerField(
verbose_name="duration of the membership (in months)"
2020-12-28 13:31:08 +00:00
),
),
(
"duration_days_membership",
models.PositiveIntegerField(
verbose_name="duration of the membership (in days, will be added to duration in months)",
),
),
(
"need_membership",
models.BooleanField(
default=True, verbose_name="need membership to be purchased"
),
),
2020-12-30 12:52:41 +00:00
(
"type_user",
models.CharField(
choices=[
("Adherent", "Member"),
("Club", "Club"),
("All", "Both of them"),
],
default="All",
max_length=255,
verbose_name="type of users concerned",
),
),
(
"available_for_everyone",
models.BooleanField(
default=False, verbose_name="is available for every user"
),
),
2020-12-28 13:31:08 +00:00
],
options={
2020-12-30 12:52:41 +00:00
"permissions": (
("view_article", "Can view an article object"),
("buy_every_article", "Can buy every article"),
),
"verbose_name": "article",
"verbose_name_plural": "articles",
},
2020-12-28 13:31:08 +00:00
),
migrations.CreateModel(
name="Banque",
bases=(
re2o.mixins.RevMixin,
re2o.mixins.AclMixin,
models.Model,
),
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
2020-12-30 12:52:41 +00:00
("name", models.CharField(max_length=255)),
],
options={
"permissions": (("view_banque", "Can view a bank object"),),
"verbose_name": "bank",
"verbose_name_plural": "banks",
},
),
2020-12-28 13:31:08 +00:00
migrations.CreateModel(
name="Paiement",
bases=(
re2o.mixins.RevMixin,
re2o.mixins.AclMixin,
models.Model,
),
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("moyen", models.CharField(max_length=255, verbose_name="method")),
2020-12-30 12:52:41 +00:00
(
"available_for_everyone",
models.BooleanField(
default=False,
verbose_name="is available for every user",
),
),
(
"is_balance",
models.BooleanField(
default=False,
editable=False,
verbose_name="is user balance",
help_text="There should be only one balance payment method.",
validators=[cotisations.models.check_no_balance],
),
),
2020-12-28 13:31:08 +00:00
],
options={
2020-12-30 12:52:41 +00:00
"permissions": (
("view_paiement", "Can view a payment method object"),
("use_every_payment", "Can use every payment method"),
),
2020-12-28 13:31:08 +00:00
"verbose_name": "payment method",
2020-12-30 12:52:41 +00:00
"verbose_name_plural": "payment methods",
},
),
2020-12-28 13:31:08 +00:00
migrations.CreateModel(
name="Cotisation",
bases=(
re2o.mixins.RevMixin,
re2o.mixins.AclMixin,
models.Model,
),
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
2020-12-30 12:52:41 +00:00
(
"date_start_con",
models.DateTimeField(verbose_name="start date for the connection"),
),
(
"date_end_con",
models.DateTimeField(verbose_name="end date for the connection"),
),
(
"date_start_memb",
models.DateTimeField(verbose_name="start date for the membership"),
),
(
"date_end_memb",
models.DateTimeField(verbose_name="end date for the membership"),
),
],
2020-12-28 13:31:08 +00:00
options={
2020-12-30 12:52:41 +00:00
"permissions": (
("view_cotisation", "Can view a subscription object"),
("change_all_cotisation", "Can edit the previous subscriptions"),
),
"verbose_name": "subscription",
"verbose_name_plural": "subscriptions",
},
),
2020-12-28 13:31:08 +00:00
migrations.CreateModel(
name="BalancePayment",
bases=(cotisations.payment_methods.mixins.PaymentMethodMixin, models.Model),
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
2020-12-30 12:52:41 +00:00
(
"minimum_balance",
models.DecimalField(
verbose_name="minimum balance",
help_text="The minimal amount of money allowed for the balance at the end of a payment. You can specify a negative amount.",
max_digits=5,
decimal_places=2,
default=0,
),
),
(
"maximum_balance",
models.DecimalField(
verbose_name="maximum balance",
help_text="The maximal amount of money allowed for the balance.",
max_digits=5,
decimal_places=2,
default=50,
blank=True,
null=True,
),
),
(
"credit_balance_allowed",
models.BooleanField(
verbose_name="allow user to credit their balance", default=False
),
),
],
options={"verbose_name": "user balance"},
2020-12-30 12:52:41 +00:00
),
2020-12-28 13:31:08 +00:00
migrations.CreateModel(
name="ChequePayment",
bases=(cotisations.payment_methods.mixins.PaymentMethodMixin, models.Model),
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
2020-12-30 12:52:41 +00:00
],
options={"verbose_name": "cheque"},
2020-12-30 12:52:41 +00:00
),
2020-12-28 13:31:08 +00:00
migrations.CreateModel(
name="ComnpayPayment",
bases=(cotisations.payment_methods.mixins.PaymentMethodMixin, models.Model),
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
2020-12-30 12:52:41 +00:00
(
"payment_credential",
models.CharField(
max_length=255,
default="",
blank=True,
verbose_name="ComNpay VAT Number",
),
),
(
"payment_pass",
re2o.aes_field.AESEncryptedField(
max_length=255,
null=True,
blank=True,
verbose_name="ComNpay secret key",
),
),
(
"minimum_payment",
models.DecimalField(
verbose_name="minimum payment",
help_text="The minimal amount of money you have to use when paying with ComNpay.",
max_digits=5,
decimal_places=2,
default=1,
),
),
(
"production",
models.BooleanField(
default=True,
verbose_name="production mode enabled (production URL, instead of homologation)",
),
),
],
options={"verbose_name": "ComNpay"},
2020-12-30 12:52:41 +00:00
),
2020-12-28 13:31:08 +00:00
migrations.CreateModel(
name="FreePayment",
bases=(cotisations.payment_methods.mixins.PaymentMethodMixin, models.Model),
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
2020-12-30 12:52:41 +00:00
],
options={"verbose_name": "Free payment"},
2020-12-30 12:52:41 +00:00
),
2020-12-28 13:31:08 +00:00
migrations.CreateModel(
name="NotePayment",
bases=(cotisations.payment_methods.mixins.PaymentMethodMixin, models.Model),
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("server", models.CharField(max_length=255, verbose_name="server")),
("port", models.PositiveIntegerField(blank=True, null=True)),
2020-12-30 12:52:41 +00:00
("id_note", models.PositiveIntegerField(blank=True, null=True)),
],
options={"verbose_name": "NoteKfet"},
2020-12-30 12:52:41 +00:00
),
]