Enforce a sane last payment date (#412)

This commit is contained in:
Tobias Kunze
2017-02-15 16:37:10 +01:00
committed by Raphael Michel
parent 7b33fc6633
commit 9b7223c0e8
2 changed files with 26 additions and 0 deletions

View File

@@ -294,6 +294,17 @@ class PaymentSettingsForm(SettingsForm):
"(in percent)."),
)
def clean(self):
cleaned_data = super().clean()
payment_term_last = cleaned_data.get('payment_term_last')
if payment_term_last and self.obj.presale_end:
if payment_term_last < self.obj.presale_end.date():
self.add_error(
'payment_term_last',
_('The last payment date cannot be before the end of presale.'),
)
return cleaned_data
class ProviderForm(SettingsForm):
"""