1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-23 07:52:23 +00:00

Fix note migration

This commit is contained in:
Alexandre Iooss 2019-07-16 09:17:46 +02:00
parent b1d96fae3f
commit 9d56b6ecbf
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 18 additions and 24 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 2.2.3 on 2019-07-08 14:08
# Generated by Django 2.2.3 on 2019-07-16 07:17
from django.conf import settings
from django.db import migrations, models
@ -19,8 +19,8 @@ class Migration(migrations.Migration):
name='NoteClub',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('solde', models.IntegerField(help_text="en centime, l' argent crédité pour cette instance", verbose_name='solde du compte')),
('active', models.BooleanField(default=True, verbose_name='etat du compte')),
('balance', models.DecimalField(decimal_places=2, default=0, help_text='money credited for this instance', max_digits=8, verbose_name='account balance')),
('is_active', models.BooleanField(default=True, verbose_name='is active')),
],
options={
'abstract': False,
@ -30,9 +30,9 @@ class Migration(migrations.Migration):
name='NoteSpec',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('solde', models.IntegerField(help_text="en centime, l' argent crédité pour cette instance", verbose_name='solde du compte')),
('active', models.BooleanField(default=True, verbose_name='etat du compte')),
('account_type', models.CharField(choices=[('CH', 'chèques'), ('CB', 'Carte Bancaire'), ('VB', 'Virement Bancaire'), ('CA', 'Cash'), ('RB', 'Remboursement')], max_length=2, unique=True)),
('balance', models.DecimalField(decimal_places=2, default=0, help_text='money credited for this instance', max_digits=8, verbose_name='account balance')),
('is_active', models.BooleanField(default=True, verbose_name='is active')),
('account_type', models.CharField(choices=[('CH', 'bank check'), ('CB', 'credit card'), ('VB', 'bank transfer'), ('CA', 'cash'), ('RB', 'refund')], max_length=2, unique=True)),
],
options={
'abstract': False,
@ -42,13 +42,13 @@ class Migration(migrations.Migration):
name='NoteUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('solde', models.IntegerField(help_text="en centime, l' argent crédité pour cette instance", verbose_name='solde du compte')),
('active', models.BooleanField(default=True, verbose_name='etat du compte')),
('balance', models.DecimalField(decimal_places=2, default=0, help_text='money credited for this instance', max_digits=8, verbose_name='account balance')),
('is_active', models.BooleanField(default=True, verbose_name='is active')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': "One's Note",
'verbose_name_plural': 'Users Note',
'verbose_name': "one's note",
'verbose_name_plural': 'users note',
},
),
migrations.CreateModel(

View File

@ -41,6 +41,8 @@ class Note(models.Model):
verbose_name=_('account balance'),
help_text=_("money credited for this instance"),
decimal_places=2, # Limit to centimes
max_digits=8, # Limit to 999999,99€
default=0,
)
is_active = models.BooleanField(
default=True,
@ -64,27 +66,19 @@ class NoteUser(Note):
verbose_name = _("one's note")
verbose_name_plural = _("users note")
def __str__(self):
return self.user.get_username()
class NoteSpec(Note):
"""
A Note for special Account, where real money enter or leave the system.
- Cash
- Credit Card
- Bank Transfert
- Bank Check
- Refund
A Note for special account, where real money enter or leave the system
"""
account_type = models.CharField(
max_length=2,
choices=(
("CH", "chèques"),
("CB", "Carte Bancaire"),
("VB", "Virement Bancaire"),
("CA", "Cash"),
("RB", "Remboursement")
("CH", _("bank check")),
("CB", _("credit card")),
("VB", _("bank transfer")),
("CA", _("cash")),
("RB", _("refund")),
),
unique=True,
)