From 2e6bfc9b75d0b21d858baf1b43d344fc0a5a5b48 Mon Sep 17 00:00:00 2001 From: Christian Merten Date: Sat, 18 Jan 2025 23:01:11 +0100 Subject: [PATCH] finance/statement: make allowance_to optional If an excursion has zero admissable youth leaders, the statement and hence the excursion currently can't be saved, because the `allowance_to` field has to be non-empty, but the number of entries has to be zero. This commit hence makes the field optional. --- .../0007_alter_statement_allowance_to.py | 19 +++++++++++++++++++ jdav_web/finance/models.py | 1 + 2 files changed, 20 insertions(+) create mode 100644 jdav_web/finance/migrations/0007_alter_statement_allowance_to.py diff --git a/jdav_web/finance/migrations/0007_alter_statement_allowance_to.py b/jdav_web/finance/migrations/0007_alter_statement_allowance_to.py new file mode 100644 index 0000000..237ced2 --- /dev/null +++ b/jdav_web/finance/migrations/0007_alter_statement_allowance_to.py @@ -0,0 +1,19 @@ +# Generated by Django 4.0.1 on 2025-01-18 22:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('members', '0033_freizeit_approved_extra_youth_leader_count'), + ('finance', '0006_statement_add_allowance_to_subsidy_to'), + ] + + operations = [ + migrations.AlterField( + model_name='statement', + name='allowance_to', + field=models.ManyToManyField(blank=True, help_text='The youth leaders to which an allowance should be paid. The count must match the number of permitted youth leaders.', related_name='receives_allowance_for_statements', to='members.Member', verbose_name='Pay allowance to'), + ), + ] diff --git a/jdav_web/finance/models.py b/jdav_web/finance/models.py index 81e62b0..cf084ca 100644 --- a/jdav_web/finance/models.py +++ b/jdav_web/finance/models.py @@ -61,6 +61,7 @@ class Statement(CommonModel): allowance_to = models.ManyToManyField(Member, verbose_name=_('Pay allowance to'), related_name='receives_allowance_for_statements', + blank=True, help_text=_('The youth leaders to which an allowance should be paid. The count must match the number of permitted youth leaders.')) subsidy_to = models.ForeignKey(Member, verbose_name=_('Pay subsidy to'), null=True,