Backend UX: Hide advanced tax rule settings

This commit is contained in:
Raphael Michel
2018-03-26 10:15:36 +02:00
parent 12b5e21314
commit 28a628ec93
2 changed files with 96 additions and 76 deletions

View File

@@ -125,6 +125,10 @@ class TaxRule(LoggedModel):
s += ' ({})'.format(_('reverse charge enabled'))
return str(s)
@property
def has_custom_rules(self):
return self.custom_rules and self.custom_rules != '[]'
def tax(self, base_price, base_price_is='auto'):
if self.rate == Decimal('0.00'):
return TaxedPrice(

View File

@@ -20,11 +20,24 @@
{% bootstrap_form_errors form %}
{% bootstrap_field form.name layout="control" %}
{% bootstrap_field form.rate addon_after="%" layout="control" %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#advanced">
<strong>{% trans "Advanced settings" %}</strong>
<i class="fa fa-angle-down collapse-indicator"></i>
</a>
</h4>
</div>
<div id="advanced" class="panel-collapse collapsed {% if rule.eu_reverse_charge or rule.has_custom_rules or form.errors %}in{% endif %}">
<div class="panel-body">
<legend>{% trans "Advanced settings" %}</legend>
<div class="alert alert-warning">
<span class="fa fa-fw fa-legal fa-4x pull-left"></span>
{% blocktrans trimmed with docs="https://docs.pretix.eu/en/latest/user/events/taxes.html" %}
These settings are intended for advanced users. See the <a href="{{ docs }}">documentation</a>
These settings are intended for advanced users. See the
<a href="{{ docs }}">documentation</a>
for more information. Note that we are not responsible for the correct handling
of taxes in your ticket shop. If in doubt, please contact a lawyer or tax consultant.
{% endblocktrans %}
@@ -100,6 +113,9 @@
<i class="fa fa-plus"></i> {% trans "Add a new rule" %}</button>
</p>
</div>
</div>
</div>
</div>
<div class="form-group submit-group">