Fix #1067 -- Allow to manually create partial payments

This commit is contained in:
Raphael Michel
2018-12-02 18:32:16 +01:00
parent b1cebdbd99
commit b93e7fcb60
4 changed files with 37 additions and 12 deletions

View File

@@ -49,7 +49,7 @@ class ExtendForm(I18nModelForm):
return data
class MarkPaidForm(forms.Form):
class ConfirmPaymentForm(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 '
@@ -75,6 +75,20 @@ class MarkPaidForm(forms.Form):
del self.fields['force']
class MarkPaidForm(ConfirmPaymentForm):
amount = forms.DecimalField(
required=True,
max_digits=10, decimal_places=2,
localize=True,
label=_('Payment amount'),
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
change_decimal_field(self.fields['amount'], self.instance.event.currency)
self.fields['amount'].initial = max(0, self.instance.pending_sum)
class ExporterForm(forms.Form):
def clean(self):
data = super().clean()