From df515d7cac440f5e043744bbc7955c441f7bf4ee Mon Sep 17 00:00:00 2001 From: mariusrklein <47218379+mariusrklein@users.noreply.github.com> Date: Sat, 25 Jan 2025 11:42:03 +0100 Subject: [PATCH] allowed missing subsidy/allowance receivers in admin form and cost overview --- jdav_web/finance/models.py | 3 ++- jdav_web/members/admin.py | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/jdav_web/finance/models.py b/jdav_web/finance/models.py index de10941..3201440 100644 --- a/jdav_web/finance/models.py +++ b/jdav_web/finance/models.py @@ -164,7 +164,8 @@ class Statement(CommonModel): @property def allowance_to_valid(self): """Checks if the configured `allowance_to` field matches the regulations.""" - if self.allowance_to.count() != self.real_staff_count: + if self.allowance_to.count() > self.real_staff_count: + # it is allows that less allowances are utilized than youth leaders are enlisted return False if self.excursion is not None: yls = self.excursion.jugendleiter.all() diff --git a/jdav_web/members/admin.py b/jdav_web/members/admin.py index 6bd9cbe..9a46ce6 100644 --- a/jdav_web/members/admin.py +++ b/jdav_web/members/admin.py @@ -866,11 +866,6 @@ class StatementOnListForm(forms.ModelForm): 'allowance_to': _("This excursion only has up to %(approved_count)s approved youth leaders, but you listed %(entered_count)s.") % {'approved_count': str(excursion.approved_staff_count), 'entered_count': str(allowance_to.count())}, }) - if allowance_to.count() < min(excursion.approved_staff_count, excursion.jugendleiter.count()): - raise ValidationError({ - 'allowance_to': _("This excursion has %(approved_count)s approved youth leaders, but you listed only %(entered_count)s.") % {'approved_count': str(excursion.approved_staff_count), - 'entered_count': str(allowance_to.count())}, - }) class StatementOnListInline(CommonAdminInlineMixin, nested_admin.NestedStackedInline):