Fix #54 -- Allow the admin to force accept payments

This commit is contained in:
Raphael Michel
2018-06-01 13:25:07 +02:00
parent 6ccf55b601
commit 85420602e8
5 changed files with 94 additions and 9 deletions

View File

@@ -36,7 +36,9 @@ class ExtendForm(I18nModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.instance.status == Order.STATUS_PENDING or self.instance._is_still_available(now(), count_waitinglist=False) is True:
if self.instance.status == Order.STATUS_PENDING or self.instance._is_still_available(now(),
count_waitinglist=False)\
is True:
del self.fields['quota_ignore']
def clean(self):
@@ -47,8 +49,33 @@ class ExtendForm(I18nModelForm):
return data
class ExporterForm(forms.Form):
class MarkPaidForm(forms.Form):
force = forms.BooleanField(
label=_('Overbook quota and ignore late payment'),
help_text=_('If you check this box, this operation will be performed even if it leads to an overbooked quota '
'and you having sold more tickets than you planned! The operation will also be performed '
'regardless of the settings for late payments.'),
required=False
)
def __init__(self, *args, **kwargs):
self.instance = kwargs.pop("instance")
super().__init__(*args, **kwargs)
quota_fail = (
self.instance.status == Order.STATUS_PENDING or
self.instance._is_still_available(now(), count_waitinglist=False) is True
)
term_last = self.instance.payment_term_last
term_fail = (
(not term_last or term_last >= now()) and
(self.instance.status == Order.STATUS_PENDING or self.instance.event.settings.get(
'payment_term_accept_late'))
)
if quota_fail or term_fail:
del self.fields['force']
class ExporterForm(forms.Form):
def clean(self):
data = super().clean()