Skip to content

Commit

Permalink
[FIX] Adjust price in USD for products used in tests
Browse files Browse the repository at this point in the history
env.ref("product.product_product_10") is a demo data we use in tests

Prior to commit 86febae278f08864e83017d43f6aa9d67165d664 in odoo
the original price (14.0 USD) was taken as EUR (from the company
currency), and converted to 16.38 USD when added to a invoice
with currency USD. This module used to convert it back to 14.0 EUR.

After 86febae278f08864e83017d43f6aa9d67165d664, the product is added
to a invoice with currency == USD with the correct price, 14.00,
which is later converted to 11.97 EUR by this module.
  • Loading branch information
TheMule71 committed Apr 15, 2022
1 parent 07f73ce commit e11f64f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
12 changes: 6 additions & 6 deletions l10n_it_fatturapa_out/tests/data/IT06363391001_00015.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<Divisa>EUR</Divisa>
<Data>2021-12-16</Data>
<Numero>INV/2021/12/0001</Numero>
<ImportoTotaleDocumento>14.00</ImportoTotaleDocumento>
<ImportoTotaleDocumento>11.97</ImportoTotaleDocumento>
<Art73>SI</Art73>
</DatiGeneraliDocumento>
</DatiGenerali>
Expand All @@ -74,21 +74,21 @@
<Descrizione>Cabinet with Doors</Descrizione>
<Quantita>1.000</Quantita>
<UnitaMisura>Unit(s)</UnitaMisura>
<PrezzoUnitario>14.00000</PrezzoUnitario>
<PrezzoTotale>14.00</PrezzoTotale>
<PrezzoUnitario>11.96581</PrezzoUnitario>
<PrezzoTotale>11.97</PrezzoTotale>
<AliquotaIVA>0.00</AliquotaIVA>
<Natura>N3.2</Natura>
<AltriDatiGestionali>
<TipoDato>Valuta</TipoDato>
<RiferimentoTesto>USD</RiferimentoTesto>
<RiferimentoNumero>16.38000</RiferimentoNumero>
<RiferimentoNumero>14.00000</RiferimentoNumero>
<RiferimentoData>2021-12-16</RiferimentoData>
</AltriDatiGestionali>
</DettaglioLinee>
<DatiRiepilogo>
<AliquotaIVA>0.00</AliquotaIVA>
<Natura>N3.2</Natura>
<ImponibileImporto>14.00</ImponibileImporto>
<ImponibileImporto>11.97</ImponibileImporto>
<Imposta>0.00</Imposta>
<RiferimentoNormativo>Not subject to VAT law</RiferimentoNormativo>
</DatiRiepilogo>
Expand All @@ -98,7 +98,7 @@
<DettaglioPagamento>
<ModalitaPagamento>MP05</ModalitaPagamento>
<DataScadenzaPagamento>2022-01-31</DataScadenzaPagamento>
<ImportoPagamento>14.00</ImportoPagamento>
<ImportoPagamento>11.97</ImportoPagamento>
</DettaglioPagamento>
</DatiPagamento>
</FatturaElettronicaBody>
Expand Down
12 changes: 6 additions & 6 deletions l10n_it_fatturapa_out/tests/data/IT06363391001_00016.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<Divisa>USD</Divisa>
<Data>2021-12-16</Data>
<Numero>INV/2021/12/0001</Numero>
<ImportoTotaleDocumento>16.38</ImportoTotaleDocumento>
<ImportoTotaleDocumento>14.00</ImportoTotaleDocumento>
<Art73>SI</Art73>
</DatiGeneraliDocumento>
</DatiGenerali>
Expand All @@ -74,21 +74,21 @@
<Descrizione>Cabinet with Doors</Descrizione>
<Quantita>1.000</Quantita>
<UnitaMisura>Unit(s)</UnitaMisura>
<PrezzoUnitario>14.00000</PrezzoUnitario>
<PrezzoTotale>14.00</PrezzoTotale>
<PrezzoUnitario>11.96581</PrezzoUnitario>
<PrezzoTotale>11.97</PrezzoTotale>
<AliquotaIVA>0.00</AliquotaIVA>
<Natura>N3.2</Natura>
<AltriDatiGestionali>
<TipoDato>Valuta</TipoDato>
<RiferimentoTesto>USD</RiferimentoTesto>
<RiferimentoNumero>16.38000</RiferimentoNumero>
<RiferimentoNumero>14.00000</RiferimentoNumero>
<RiferimentoData>2021-12-16</RiferimentoData>
</AltriDatiGestionali>
</DettaglioLinee>
<DatiRiepilogo>
<AliquotaIVA>0.00</AliquotaIVA>
<Natura>N3.2</Natura>
<ImponibileImporto>14.00</ImponibileImporto>
<ImponibileImporto>11.97</ImponibileImporto>
<Imposta>0.00</Imposta>
<RiferimentoNormativo>Not subject to VAT law</RiferimentoNormativo>
</DatiRiepilogo>
Expand All @@ -98,7 +98,7 @@
<DettaglioPagamento>
<ModalitaPagamento>MP05</ModalitaPagamento>
<DataScadenzaPagamento>2022-01-31</DataScadenzaPagamento>
<ImportoPagamento>16.38</ImportoPagamento>
<ImportoPagamento>14.00</ImportoPagamento>
</DettaglioPagamento>
</DatiPagamento>
</FatturaElettronicaBody>
Expand Down
6 changes: 6 additions & 0 deletions l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,12 @@ def test_15_xml_export(self):
invoice = invoice_form.save()
invoice.action_post()

# commit 86febae278f08864e83017d43f6aa9d67165d664 fixed this as
# a side effect: now the price is actually 14.00 USD not 16.38
# for env.ref("product.product_product_10")
# self.assertEqual(invoice.invoice_line_ids[0].price_unit, 16.38)
self.assertEqual(invoice.invoice_line_ids[0].price_unit, 14.00)

invoice.company_id.xml_divisa_value = "force_eur"
res = self.run_wizard(invoice.id)
attachment = self.attach_model.browse(res["res_id"])
Expand Down

0 comments on commit e11f64f

Please sign in to comment.