Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix]l10n_it_fatturapa_out risuzione problema fattura con anticipo #4381

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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 @@ -146,14 +147,28 @@
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

Check warning on line 154 in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py#L154

Added line #L154 was not covered by tests
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

Check warning on line 170 in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py#L169-L170

Added lines #L169 - L170 were not covered by tests

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