Fix stepping back to the invoice address

This commit is contained in:
Raphael Michel
2019-04-04 14:12:51 +02:00
parent c0df418265
commit bc01124584

View File

@@ -340,6 +340,7 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
@cached_property @cached_property
def invoice_form(self): def invoice_form(self):
if not self.invoice_address.pk:
initial = { initial = {
'name_parts': { 'name_parts': {
k[21:].replace('-', '_'): v k[21:].replace('-', '_'): v
@@ -353,6 +354,8 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
'city': self.cart_session.get('widget_data', {}).get('invoice-address-city', ''), 'city': self.cart_session.get('widget_data', {}).get('invoice-address-city', ''),
'country': self.cart_session.get('widget_data', {}).get('invoice-address-country', ''), 'country': self.cart_session.get('widget_data', {}).get('invoice-address-country', ''),
} }
else:
initial = {}
if not self.address_asked and self.request.event.settings.invoice_name_required: if not self.address_asked and self.request.event.settings.invoice_name_required:
return InvoiceNameForm(data=self.request.POST if self.request.method == "POST" else None, return InvoiceNameForm(data=self.request.POST if self.request.method == "POST" else None,
event=self.request.event, event=self.request.event,