Skip to content

Commit

Permalink
[fix]l10n_it_fatturapa_out fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matteoopenf committed Sep 24, 2024
1 parent 232beba commit 464aae5
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,28 @@ def _key(tax_id):
tax_line_id = tax_id.tax_line_id
aliquota = format_numbers(tax_line_id.amount)
key = _key(tax_line_id)
out_computed[key] = {
"AliquotaIVA": aliquota,
"Natura": tax_line_id.kind_id.code,
# 'Arrotondamento':'',
"ImponibileImporto": tax_id.tax_base_amount,
"Imposta": abs(tax_id.balance),
"EsigibilitaIVA": tax_line_id.payability,
}
tax_amount = 0
dp = self.env["decimal.precision"].precision_get("Account")
if invoice.move_type == "out_invoice":
if float_is_zero(tax_id.credit, dp) and tax_id.debit:
tax_amount = -tax_id.balance
if tax_id.credit and float_is_zero(tax_id.debit, dp):
tax_amount = abs(tax_id.balance)
else:
tax_amount = abs(tax_id.balance)
if key not in out_computed:
out_computed[key] = {
"AliquotaIVA": aliquota,
"Natura": tax_line_id.kind_id.code,
# 'Arrotondamento':'',
"ImponibileImporto": tax_id.tax_base_amount,
"Imposta": tax_amount,
"EsigibilitaIVA": tax_line_id.payability,
}
else:
out_computed[key]["ImponibileImporto"] += tax_id.tax_base_amount
out_computed[key]["Imposta"] += tax_amount

if tax_line_id.law_reference:
out_computed[key]["RiferimentoNormativo"] = encode_for_export(
tax_line_id.law_reference, 100
Expand Down

0 comments on commit 464aae5

Please sign in to comment.