From 8adb65993e77150ac711d8e64d1768284bfb49fb Mon Sep 17 00:00:00 2001 From: "Paolo Gatti (pgi)" Date: Wed, 22 Nov 2023 10:59:19 +0100 Subject: [PATCH] [FIX] l10n_it_edi: issue with IDcodice Copy-paste mistake in the template after refactoring. IDCodice for the Sender has to be filled with the CodiceFiscale and not with the VAT number. (We only use VAT number if we don't find the CodiceFiscale.) opw-3597050 closes odoo/odoo#143193 X-original-commit: 0c85e24a71442d0c0a717ee6264940047db1bdea Signed-off-by: Josse Colpaert Signed-off-by: Paolo Gatti (pgi) --- .../l10n_it_edi/data/invoice_it_template.xml | 2 +- .../invoice_vat_not_equals_codice.xml | 94 +++++++++++++++++++ addons/l10n_it_edi/tests/test_edi_export.py | 20 ++++ 3 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 addons/l10n_it_edi/tests/export_xmls/invoice_vat_not_equals_codice.xml diff --git a/addons/l10n_it_edi/data/invoice_it_template.xml b/addons/l10n_it_edi/data/invoice_it_template.xml index 1c92bf55bc8..4b1c3a1feb8 100644 --- a/addons/l10n_it_edi/data/invoice_it_template.xml +++ b/addons/l10n_it_edi/data/invoice_it_template.xml @@ -45,7 +45,7 @@ - + diff --git a/addons/l10n_it_edi/tests/export_xmls/invoice_vat_not_equals_codice.xml b/addons/l10n_it_edi/tests/export_xmls/invoice_vat_not_equals_codice.xml new file mode 100644 index 00000000000..d0cfb5445e3 --- /dev/null +++ b/addons/l10n_it_edi/tests/export_xmls/invoice_vat_not_equals_codice.xml @@ -0,0 +1,94 @@ + + + + + IT + 07149930583 + + V202200001 + FPR12 + 0000000 + + 0266766700 + test@test.it + + + + + + IT + 01698911003 + + 07149930583 + + company_2_data + + RF01 + + + 1234 Test Street + 12345 + Prova + IT + + + + + + IT + 00465840031 + + 93026890017 + + Alessi + + + + Via Privata Alessi 6 + 28887 + Milan + IT + + + + + + + TD01 + EUR + 2022-03-24 + INV/2022/00001 + 976.49 + + + + + 1 + line1 + 1.00 + 800.400000 + 800.40 + 22.00 + + + 22.00 + 800.40 + 176.09 + I + + + + TP02 + + MP05 + 2022-03-24 + 976.49 + INV/2022/00001 + + + + diff --git a/addons/l10n_it_edi/tests/test_edi_export.py b/addons/l10n_it_edi/tests/test_edi_export.py index 50791942423..2254dc36e4d 100644 --- a/addons/l10n_it_edi/tests/test_edi_export.py +++ b/addons/l10n_it_edi/tests/test_edi_export.py @@ -43,6 +43,26 @@ class TestItEdiExport(TestItEdi): 'is_company': True, }) + def test_vat_not_equals_codice(self): + self.company.partner_id.vat = '01698911003' + self.company.l10n_it_codice_fiscale = '07149930583' + + invoice = self.env['account.move'].with_company(self.company).create({ + 'move_type': 'out_invoice', + 'invoice_date': '2022-03-24', + 'invoice_date_due': '2022-03-24', + 'partner_id': self.italian_partner_a.id, + 'invoice_line_ids': [ + Command.create({ + 'name': 'line1', + 'price_unit': 800.40, + 'tax_ids': [Command.set(self.default_tax.ids)], + }), + ], + }) + invoice.action_post() + self._assert_export_invoice(invoice, 'invoice_vat_not_equals_codice.xml') + def test_export_invoice_price_included_taxes(self): """ When the tax is price included, there should be a rounding value added to the xml, if the sum(subtotals) * tax_rate is not equal to taxable base * tax rate (there is a constraint in the edi where