Fix bug on tax equivalence surcharge get when there is some refund lines that creat account invoce tax 'negatives'

This commit is contained in:
Bernat Brunet 2020-10-30 14:13:36 +01:00
parent 25dc388155
commit ca371ca42e
1 changed files with 5 additions and 4 deletions

View File

@ -134,11 +134,12 @@ class BaseTrytonInvoiceMapper(Model):
def _tax_equivalence_surcharge(self, invoice_tax):
surcharge_tax = None
for all_invoice_tax in invoice_tax.invoice.taxes:
if (all_invoice_tax.tax.recargo_equivalencia and
for invoicetax in invoice_tax.invoice.taxes:
if (invoicetax.tax.recargo_equivalencia and
invoice_tax.tax.recargo_equivalencia_related_tax ==
all_invoice_tax.tax):
surcharge_tax = all_invoice_tax
invoicetax.tax and invoicetax.base ==
invoicetax.base.copy_sign(invoice_tax.base)):
surcharge_tax = invoicetax
break
return surcharge_tax