From 5a7a219ba801cd01a216da4fcda36a0cb08d7051 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 13 Mar 2021 12:35:28 +0100 Subject: [PATCH] [invoices] Quantities can be non-integers Signed-off-by: Yohann D'ANELLO --- .../migrations/0007_auto_20210313_1235.py | 23 +++++++++++++++++ .../migrations/0005_auto_20210313_1235.py | 19 ++++++++++++++ .../migrations/0003_auto_20210313_1235.py | 25 +++++++++++++++++++ apps/treasury/models.py | 8 +++--- .../wei/migrations/0002_auto_20210313_1235.py | 23 +++++++++++++++++ 5 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 apps/member/migrations/0007_auto_20210313_1235.py create mode 100644 apps/note/migrations/0005_auto_20210313_1235.py create mode 100644 apps/treasury/migrations/0003_auto_20210313_1235.py create mode 100644 apps/wei/migrations/0002_auto_20210313_1235.py diff --git a/apps/member/migrations/0007_auto_20210313_1235.py b/apps/member/migrations/0007_auto_20210313_1235.py new file mode 100644 index 00000000..01ad2393 --- /dev/null +++ b/apps/member/migrations/0007_auto_20210313_1235.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.19 on 2021-03-13 11:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('member', '0006_create_note_account_bde_membership'), + ] + + operations = [ + migrations.AlterField( + model_name='membership', + name='roles', + field=models.ManyToManyField(related_name='memberships', to='permission.Role', verbose_name='roles'), + ), + migrations.AlterField( + model_name='profile', + name='promotion', + field=models.PositiveSmallIntegerField(default=2021, help_text='Year of entry to the school (None if not ENS student)', null=True, verbose_name='promotion'), + ), + ] diff --git a/apps/note/migrations/0005_auto_20210313_1235.py b/apps/note/migrations/0005_auto_20210313_1235.py new file mode 100644 index 00000000..09696c38 --- /dev/null +++ b/apps/note/migrations/0005_auto_20210313_1235.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.19 on 2021-03-13 11:35 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('note', '0004_remove_null_tag_on_charfields'), + ] + + operations = [ + migrations.AlterField( + model_name='alias', + name='note', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='alias', to='note.Note'), + ), + ] diff --git a/apps/treasury/migrations/0003_auto_20210313_1235.py b/apps/treasury/migrations/0003_auto_20210313_1235.py new file mode 100644 index 00000000..17fd1f99 --- /dev/null +++ b/apps/treasury/migrations/0003_auto_20210313_1235.py @@ -0,0 +1,25 @@ +# Generated by Django 2.2.19 on 2021-03-13 11:35 + +import django.core.validators +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('treasury', '0002_invoice_remove_png_extension'), + ] + + operations = [ + migrations.AlterField( + model_name='product', + name='quantity', + field=models.FloatField(validators=[django.core.validators.MinValueValidator(0)], verbose_name='Quantity'), + ), + migrations.AlterField( + model_name='specialtransactionproxy', + name='remittance', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='transaction_proxies', to='treasury.Remittance', verbose_name='Remittance'), + ), + ] diff --git a/apps/treasury/models.py b/apps/treasury/models.py index b2b2596c..bf85dd26 100644 --- a/apps/treasury/models.py +++ b/apps/treasury/models.py @@ -5,6 +5,7 @@ from datetime import date from django.contrib.auth.models import User from django.core.exceptions import ValidationError +from django.core.validators import MinValueValidator from django.db import models, transaction from django.db.models import Q from django.template.loader import render_to_string @@ -131,12 +132,13 @@ class Product(models.Model): verbose_name=_("Designation"), ) - quantity = models.PositiveIntegerField( - verbose_name=_("Quantity") + quantity = models.FloatField( + verbose_name=_("Quantity"), + validators=[MinValueValidator(0)], ) amount = models.IntegerField( - verbose_name=_("Unit price") + verbose_name=_("Unit price"), ) @property diff --git a/apps/wei/migrations/0002_auto_20210313_1235.py b/apps/wei/migrations/0002_auto_20210313_1235.py new file mode 100644 index 00000000..cb4dfbb2 --- /dev/null +++ b/apps/wei/migrations/0002_auto_20210313_1235.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.19 on 2021-03-13 11:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('wei', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='weiclub', + name='year', + field=models.PositiveIntegerField(default=2021, unique=True, verbose_name='year'), + ), + migrations.AlterField( + model_name='weiregistration', + name='information_json', + field=models.TextField(default='{}', help_text='Information about the registration (buses for old members, survey for the new members), encoded in JSON', verbose_name='registration information'), + ), + ]