Skip to content

Commit

Permalink
[FIX] l10n_it_fatturapa_out: fix issue OCA#3670
Browse files Browse the repository at this point in the history
fix case use downpayment on e-invoice

Co-authored-by: Marcoapu <m.cazzato@apuliasoftware.it>
  • Loading branch information
matteoopenf and Marcoapu committed Aug 6, 2024
1 parent e86cae7 commit ed214ee
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from odoo import api, fields, models
from odoo.exceptions import UserError
from odoo.tools import float_is_zero
from odoo.tools.translate import _

from odoo.addons.l10n_it_account.tools.account_tools import encode_for_export
Expand Down Expand Up @@ -136,12 +137,21 @@ def _key(tax_id):
tax_line_id = tax_id.tax_line_id
aliquota = format_numbers(tax_line_id.amount)
key = _key(tax_line_id)
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)
out_computed[key] = {
"AliquotaIVA": aliquota,
"Natura": tax_line_id.kind_id.code,
# 'Arrotondamento':'',
"ImponibileImporto": tax_id.tax_base_amount,
"Imposta": tax_id.price_total,
"Imposta": tax_amount,
"EsigibilitaIVA": tax_line_id.payability,
}
if tax_line_id.law_reference:
Expand Down

0 comments on commit ed214ee

Please sign in to comment.