Fix #970 -- invoice info consistency (#1043)

resolves: Issue #970
This commit is contained in:
Flavia Bastos
2018-10-16 20:50:00 -03:00
committed by Raphael Michel
parent 6e4750336b
commit a2acd336eb
2 changed files with 6 additions and 2 deletions

View File

@@ -216,6 +216,8 @@ class BaseInvoiceAddressForm(forms.ModelForm):
def clean(self):
data = self.cleaned_data
if not data.get('is_business'):
data['company'] = ''
if not data.get('name') and not data.get('company') and self.event.settings.invoice_address_required:
raise ValidationError(_('You need to provide either a company name or your name.'))

View File

@@ -87,8 +87,10 @@
</div>
<div class="panel-body">
<dl class="dl-horizontal">
<dt>{% trans "Company" %}</dt>
<dd>{{ addr.company }}</dd>
{% if addr.company %}
<dt>{% trans "Company" %}</dt>
<dd>{{ addr.company }}</dd>
{% endif %}
<dt>{% trans "Name" %}</dt>
<dd>{{ addr.name }}</dd>
<dt>{% trans "Address" %}</dt>