1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +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.conf import settings
from django.db import migrations, models from django.db import migrations, models
@ -19,8 +19,8 @@ class Migration(migrations.Migration):
name='NoteClub', name='NoteClub',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('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')), ('balance', models.DecimalField(decimal_places=2, default=0, help_text='money credited for this instance', max_digits=8, verbose_name='account balance')),
('active', models.BooleanField(default=True, verbose_name='etat du compte')), ('is_active', models.BooleanField(default=True, verbose_name='is active')),
], ],
options={ options={
'abstract': False, 'abstract': False,
@ -30,9 +30,9 @@ class Migration(migrations.Migration):
name='NoteSpec', name='NoteSpec',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('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')), ('balance', models.DecimalField(decimal_places=2, default=0, help_text='money credited for this instance', max_digits=8, verbose_name='account balance')),
('active', models.BooleanField(default=True, verbose_name='etat du compte')), ('is_active', models.BooleanField(default=True, verbose_name='is active')),
('account_type', models.CharField(choices=[('CH', 'chèques'), ('CB', 'Carte Bancaire'), ('VB', 'Virement Bancaire'), ('CA', 'Cash'), ('RB', 'Remboursement')], max_length=2, unique=True)), ('account_type', models.CharField(choices=[('CH', 'bank check'), ('CB', 'credit card'), ('VB', 'bank transfer'), ('CA', 'cash'), ('RB', 'refund')], max_length=2, unique=True)),
], ],
options={ options={
'abstract': False, 'abstract': False,
@ -42,13 +42,13 @@ class Migration(migrations.Migration):
name='NoteUser', name='NoteUser',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('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')), ('balance', models.DecimalField(decimal_places=2, default=0, help_text='money credited for this instance', max_digits=8, verbose_name='account balance')),
('active', models.BooleanField(default=True, verbose_name='etat du compte')), ('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)), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
], ],
options={ options={
'verbose_name': "One's Note", 'verbose_name': "one's note",
'verbose_name_plural': 'Users Note', 'verbose_name_plural': 'users note',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(

View File

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