Skip to content

Commit 319d920

Browse files
fix: 🐛 check invoice tax rates are non null in __taxes_match_total_incl and __taxes_match_total_excl
1 parent 2696e43 commit 319d920

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

mindee/documents/invoice.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ def __taxes_match_total_incl(self):
208208
total_vat = 0
209209
reconstructed_total = 0
210210
for tax in self.taxes:
211+
if tax.value is None or tax.rate is None or tax.rate == 0:
212+
return False
211213
total_vat += tax.value
212214
reconstructed_total += tax.value + 100 * tax.value / tax.rate
213215

@@ -241,6 +243,8 @@ def __taxes_match_total_excl(self):
241243
total_vat = 0
242244
reconstructed_total = 0
243245
for tax in self.taxes:
246+
if tax.value is None or tax.rate is None or tax.rate == 0:
247+
return False
244248
total_vat += tax.value
245249
reconstructed_total += 100 * tax.value / tax.rate
246250

0 commit comments

Comments
 (0)