Skip to content

Commit

Permalink
[8.0][aeat_sii][FIX] Corrección para cómputo correcto del signo de ti…
Browse files Browse the repository at this point in the history
…po impositivo y cuota
  • Loading branch information
pedrorgil committed Jul 14, 2017
1 parent b129d14 commit ae9021b
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions l10n_es_aeat_sii/models/account_invoice.py
Expand Up @@ -1188,16 +1188,21 @@ def _update_sii_tax_line(self, tax_dict, tax_line):
"""
self.ensure_one()
if tax_line.child_depend:
tax_type = tax_line.child_ids.filtered('amount')[:1].amount
tax_type = abs(tax_line.child_ids.filtered('amount')[:1].amount)
else:
tax_type = tax_line.amount
tax_type = abs(tax_line.amount)
if tax_type not in tax_dict:
tax_dict[tax_type] = {
'TipoImpositivo': str(tax_type * 100),
'BaseImponible': 0,
'CuotaRepercutida': 0,
'CuotaSoportada': 0,
}
taxes = tax_line.compute_all(
self._get_sii_line_price_unit(), self.quantity,
self.product_id, self.invoice_id.partner_id,
)
tax_dict[tax_type]['BaseImponible'] += taxes['total']
# Recargo de equivalencia
tax_line_req = self._get_sii_tax_line_req()
if tax_line_req:
Expand All @@ -1207,16 +1212,16 @@ def _update_sii_tax_line(self, tax_dict, tax_line):
tax_dict[tax_type].setdefault('CuotaRecargoEquivalencia', 0)
tax_dict[tax_type]['CuotaRecargoEquivalencia'] += cuota_recargo
# Rest of the taxes
taxes = tax_line.compute_all(
self._get_sii_line_price_unit(), self.quantity,
self.product_id, self.invoice_id.partner_id,
)
tax_dict[tax_type]['BaseImponible'] += taxes['total']
if self.invoice_id.type in ['out_invoice', 'out_refund']:
key = 'CuotaRepercutida'
else:
key = 'CuotaSoportada'
tax_dict[tax_type][key] += taxes['taxes'][0]['amount']
if taxes['total'] >= 0:
sii_included_taxes = [t for t in taxes['taxes'] if t['amount'] >= 0]
else:
sii_included_taxes = [t for t in taxes['taxes'] if t['amount'] < 0]
for tax in sii_included_taxes:
tax_dict[tax_type][key] += tax['amount']


@job(default_channel='root.invoice_validate_sii')
Expand Down

0 comments on commit ae9021b

Please sign in to comment.