Fix #1144 -- Make invoice form all-optional in backend

This commit is contained in:
Raphael Michel
2019-01-23 10:27:09 +01:00
parent 5bfb00db73
commit 9ed49888b8
2 changed files with 6 additions and 2 deletions

View File

@@ -146,6 +146,7 @@ class OrderQuestionsViewMixin(BaseQuestionsViewMixin):
invoice_form_class = BaseInvoiceAddressForm
invoice_name_form_class = BaseInvoiceNameForm
only_user_visible = True
all_optional = False
@cached_property
def _positions_for_questions(self):
@@ -189,12 +190,14 @@ class OrderQuestionsViewMixin(BaseQuestionsViewMixin):
return self.invoice_name_form_class(
data=self.request.POST if self.request.method == "POST" else None,
event=self.request.event,
instance=self.invoice_address, validate_vat_id=False
instance=self.invoice_address, validate_vat_id=False,
all_optional=self.all_optional
)
return self.invoice_form_class(
data=self.request.POST if self.request.method == "POST" else None,
event=self.request.event,
instance=self.invoice_address, validate_vat_id=False
instance=self.invoice_address, validate_vat_id=False,
all_optional=self.all_optional,
)
def get_context_data(self, **kwargs):

View File

@@ -1255,6 +1255,7 @@ class OrderModifyInformation(OrderQuestionsViewMixin, OrderView):
permission = 'can_change_orders'
template_name = 'pretixcontrol/order/change_questions.html'
only_user_visible = False
all_optional = True
def post(self, request, *args, **kwargs):
failed = not self.save() or not self.invoice_form.is_valid()