Skip to content

Commit

Permalink
[FIX][l10n_it_vat_statement_communication] fix encoding file and remo…
Browse files Browse the repository at this point in the history
…ve zero value from xml in according the specification of ADE
  • Loading branch information
matteoopenf committed May 21, 2024
1 parent b602391 commit 6687904
Showing 1 changed file with 83 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ def get_export_xml(self):
x1_Fornitura.append(x1_2_Comunicazione)

xml_string = etree.tostring(
x1_Fornitura, encoding="utf8", method="xml", pretty_print=True
x1_Fornitura,
encoding="utf8",
method="xml",
pretty_print=True,
xml_declaration=True,
)
return xml_string

Expand Down Expand Up @@ -257,6 +261,9 @@ def _export_xml_get_intestazione(self):
x1_1_Intestazione, etree.QName(NS_IV, "CodiceCarica")
)
x1_1_3_CodiceCarica.text = str(self.codice_carica_id.code)
import pdb

Check warning on line 264 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L264

Added line #L264 was not covered by tests

pdb.set_trace()

Check warning on line 266 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L266

Added line #L266 was not covered by tests
return x1_1_Intestazione

def _export_xml_get_frontespizio(self):
Expand Down Expand Up @@ -405,59 +412,85 @@ def _export_xml_get_dati_modulo(self, quadro):
".", ","
)
# 1.2.2.1.11 DebitoPrecedente
DebitoPrecedente = etree.SubElement(
xModulo, etree.QName(NS_IV, "DebitoPrecedente")
)
DebitoPrecedente.text = "{:.2f}".format(
quadro.debito_periodo_precedente
).replace(".", ",")
# 1.2.2.1.12 CreditoPeriodoPrecedente
CreditoPeriodoPrecedente = etree.SubElement(
xModulo, etree.QName(NS_IV, "CreditoPeriodoPrecedente")
)
CreditoPeriodoPrecedente.text = "{:.2f}".format(
quadro.credito_periodo_precedente
).replace(".", ",")
if quadro.debito_periodo_precedente != 0.0:
DebitoPrecedente = etree.SubElement(

Check warning on line 416 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L416

Added line #L416 was not covered by tests
xModulo, etree.QName(NS_IV, "DebitoPrecedente")
)
# import pdb;pdb.set_trace()
DebitoPrecedente.text = "{:.2f}".format(

Check warning on line 420 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L420

Added line #L420 was not covered by tests
quadro.debito_periodo_precedente
).replace(".", ",")

if quadro.credito_periodo_precedente != 0.0:
# 1.2.2.1.12 CreditoPeriodoPrecedente
CreditoPeriodoPrecedente = etree.SubElement(

Check warning on line 426 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L426

Added line #L426 was not covered by tests
xModulo, etree.QName(NS_IV, "CreditoPeriodoPrecedente")
)
CreditoPeriodoPrecedente.text = "{:.2f}".format(

Check warning on line 429 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L429

Added line #L429 was not covered by tests
quadro.credito_periodo_precedente
).replace(".", ",")
# 1.2.2.1.13 CreditoAnnoPrecedente
CreditoAnnoPrecedente = etree.SubElement(
xModulo, etree.QName(NS_IV, "CreditoAnnoPrecedente")
)
CreditoAnnoPrecedente.text = "{:.2f}".format(
quadro.credito_anno_precedente
).replace(".", ",")
# 1.2.2.1.14 VersamentiAutoUE
VersamentiAutoUE = etree.SubElement(
xModulo, etree.QName(NS_IV, "VersamentiAutoUE")
)
VersamentiAutoUE.text = "{:.2f}".format(quadro.versamento_auto_UE).replace(
".", ","
)
# 1.2.2.1.15 CreditiImposta
CreditiImposta = etree.SubElement(xModulo, etree.QName(NS_IV, "CreditiImposta"))
CreditiImposta.text = "{:.2f}".format(quadro.crediti_imposta).replace(".", ",")
# 1.2.2.1.16 InteressiDovuti
InteressiDovuti = etree.SubElement(
xModulo, etree.QName(NS_IV, "InteressiDovuti")
)
InteressiDovuti.text = "{:.2f}".format(quadro.interessi_dovuti).replace(
".", ","
)
if quadro.credito_anno_precedente != 0.0:
CreditoAnnoPrecedente = etree.SubElement(

Check warning on line 434 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L434

Added line #L434 was not covered by tests
xModulo, etree.QName(NS_IV, "CreditoAnnoPrecedente")
)
CreditoAnnoPrecedente.text = "{:.2f}".format(

Check warning on line 437 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L437

Added line #L437 was not covered by tests
quadro.credito_anno_precedente
).replace(".", ",")

if quadro.versamento_auto_UE != 0.0:
# 1.2.2.1.14 VersamentiAutoUE

VersamentiAutoUE = etree.SubElement(

Check warning on line 444 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L444

Added line #L444 was not covered by tests
xModulo, etree.QName(NS_IV, "VersamentiAutoUE")
)
VersamentiAutoUE.text = "{:.2f}".format(quadro.versamento_auto_UE).replace(

Check warning on line 447 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L447

Added line #L447 was not covered by tests
".", ","
)

if quadro.crediti_imposta != 0.0:
# 1.2.2.1.15 CreditiImposta
CreditiImposta = etree.SubElement(

Check warning on line 453 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L453

Added line #L453 was not covered by tests
xModulo, etree.QName(NS_IV, "CreditiImposta")
)
CreditiImposta.text = "{:.2f}".format(quadro.crediti_imposta).replace(

Check warning on line 456 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L456

Added line #L456 was not covered by tests
".", ","
)

if quadro.interessi_dovuti != 0.0:
# 1.2.2.1.16 InteressiDovuti
InteressiDovuti = etree.SubElement(

Check warning on line 462 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L462

Added line #L462 was not covered by tests
xModulo, etree.QName(NS_IV, "InteressiDovuti")
)
InteressiDovuti.text = "{:.2f}".format(quadro.interessi_dovuti).replace(

Check warning on line 465 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L465

Added line #L465 was not covered by tests
".", ","
)
# 1.2.2.1.17 Acconto
if quadro.metodo_calcolo_acconto:
if quadro.metodo_calcolo_acconto != 0.0:
Metodo = etree.SubElement(xModulo, etree.QName(NS_IV, "Metodo"))
Metodo.text = quadro.metodo_calcolo_acconto
Acconto = etree.SubElement(xModulo, etree.QName(NS_IV, "Acconto"))
Acconto.text = "{:.2f}".format(quadro.accounto_dovuto).replace(".", ",")
# 1.2.2.1.18 ImportoDaVersare
ImportoDaVersare = etree.SubElement(
xModulo, etree.QName(NS_IV, "ImportoDaVersare")
)
ImportoDaVersare.text = "{:.2f}".format(quadro.iva_da_versare).replace(".", ",")
# 1.2.2.1.19 ImportoACredito
ImportoACredito = etree.SubElement(
xModulo, etree.QName(NS_IV, "ImportoACredito")
)
ImportoACredito.text = "{:.2f}".format(quadro.iva_a_credito).replace(".", ",")

if quadro.accounto_dovuto != 0.0:
Acconto = etree.SubElement(xModulo, etree.QName(NS_IV, "Acconto"))
Acconto.text = "{:.2f}".format(quadro.accounto_dovuto).replace(".", ",")

Check warning on line 475 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L474-L475

Added lines #L474 - L475 were not covered by tests

if quadro.iva_da_versare != 0.0:
# 1.2.2.1.18 ImportoDaVersare
ImportoDaVersare = etree.SubElement(

Check warning on line 479 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L479

Added line #L479 was not covered by tests
xModulo, etree.QName(NS_IV, "ImportoDaVersare")
)
ImportoDaVersare.text = "{:.2f}".format(quadro.iva_da_versare).replace(

Check warning on line 482 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L482

Added line #L482 was not covered by tests
".", ","
)

if quadro.iva_a_credito != 0.0:
# 1.2.2.1.19 ImportoACredito
ImportoACredito = etree.SubElement(

Check warning on line 488 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L488

Added line #L488 was not covered by tests
xModulo, etree.QName(NS_IV, "ImportoACredito")
)
ImportoACredito.text = "{:.2f}".format(quadro.iva_a_credito).replace(

Check warning on line 491 in l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_vat_statement_communication/models/comunicazione_liquidazione.py#L491

Added line #L491 was not covered by tests
".", ","
)

return xModulo

Expand Down

0 comments on commit 6687904

Please sign in to comment.