Fix custom taxation without invoice addresses

This commit is contained in:
Raphael Michel
2018-05-28 16:23:34 +02:00
parent 86117091fe
commit 5383a8b77c
2 changed files with 14 additions and 12 deletions

View File

@@ -160,6 +160,7 @@ class TaxRule(LoggedModel):
def get_matching_rule(self, invoice_address):
rules = json.loads(self.custom_rules)
if invoice_address:
for r in rules:
if r['country'] == 'EU' and str(invoice_address.country) not in EU_COUNTRIES:
continue

View File

@@ -51,6 +51,7 @@
checked in order and once the first rule matches the order, it will be used and all further rules will
be ignored. If no rule matches, tax will be charged.
{% endblocktrans %}
{% trans "All of these rules will only apply if an invoice address is set." %}
</div>
<div class="formset" data-formset data-formset-prefix="{{ formset.prefix }}">