mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Payment term in minutes (#1760)
Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
@@ -584,9 +584,11 @@ class CancelSettingsForm(SettingsForm):
|
||||
|
||||
class PaymentSettingsForm(SettingsForm):
|
||||
auto_fields = [
|
||||
'payment_term_mode',
|
||||
'payment_term_days',
|
||||
'payment_term_last',
|
||||
'payment_term_weekdays',
|
||||
'payment_term_minutes',
|
||||
'payment_term_last',
|
||||
'payment_term_expire_automatically',
|
||||
'payment_term_accept_late',
|
||||
'payment_explanation',
|
||||
@@ -599,6 +601,18 @@ class PaymentSettingsForm(SettingsForm):
|
||||
"will set the tax rate and reverse charge rules, other settings of the tax rule are ignored.")
|
||||
)
|
||||
|
||||
def clean_payment_term_days(self):
|
||||
value = self.cleaned_data.get('payment_term_days')
|
||||
if self.cleaned_data.get('payment_term_mode') == 'days' and value is None:
|
||||
raise ValidationError(_("This field is required."))
|
||||
return value
|
||||
|
||||
def clean_payment_term_minutes(self):
|
||||
value = self.cleaned_data.get('payment_term_minutes')
|
||||
if self.cleaned_data.get('payment_term_mode') == 'minutes' and value is None:
|
||||
raise ValidationError(_("This field is required."))
|
||||
return value
|
||||
|
||||
def clean(self):
|
||||
data = super().clean()
|
||||
settings_dict = self.obj.settings.freeze()
|
||||
|
||||
Reference in New Issue
Block a user