diff --git a/addons/l10n_it_edi_withholding/data/invoice_it_template.xml b/addons/l10n_it_edi_withholding/data/invoice_it_template.xml index 75fc5954f84..999eaa308f7 100644 --- a/addons/l10n_it_edi_withholding/data/invoice_it_template.xml +++ b/addons/l10n_it_edi_withholding/data/invoice_it_template.xml @@ -21,8 +21,8 @@ SI - - + + diff --git a/addons/l10n_it_edi_withholding/tests/export_xmls/inps_tax_invoice.xml b/addons/l10n_it_edi_withholding/tests/export_xmls/inps_tax_invoice.xml new file mode 100644 index 00000000000..0978fd4a064 --- /dev/null +++ b/addons/l10n_it_edi_withholding/tests/export_xmls/inps_tax_invoice.xml @@ -0,0 +1,137 @@ + + + + + + IT + 01234560157 + + ___ignore___ + FPR12 + 0000000 + + 0266766700 + test@test.it + + + + + + IT + 01234560157 + + 01234560157 + + company_2_data + + RF01 + + + 1234 Test Street + 12345 + Prova + IT + + + + + + IT + 00465840031 + + 93026890017 + + Alessi + + + + Via Privata Alessi 6 + 28887 + Milan + IT + + + + + + + TD01 + EUR + ___ignore___ + ___ignore___ + + TC22 + 4.00 + 30.00 + 750.00 + 0.00 + N2.2 + + 780.00 + + + + + 1 + + Ordinary accounting service for the year + + 1.00 + 350.000000 + 350.00 + 0.00 + N2.2 + + + 2 + + Balance deposit for the past year + + 1.00 + 300.000000 + 300.00 + 0.00 + N2.2 + + + 3 + + Ordinary accounting service for the trimester + + 1.00 + 50.000000 + 50.00 + 0.00 + N2.2 + + + 4 + + Electronic invoices management + + 1.00 + 50.000000 + 50.00 + 0.00 + N2.2 + + + 0.00 + N2.2 + 780.00 + 0.00 + I + Fatture emesse o ricevute da contribuenti forfettari o minimi + + + + TP02 + + MP05 + ___ignore___ + 780.00 + ___ignore___ + + + + diff --git a/addons/l10n_it_edi_withholding/tests/test_withholding.py b/addons/l10n_it_edi_withholding/tests/test_withholding.py index 2da158812c1..f528b5be40d 100644 --- a/addons/l10n_it_edi_withholding/tests/test_withholding.py +++ b/addons/l10n_it_edi_withholding/tests/test_withholding.py @@ -26,6 +26,17 @@ class TestWithholdingAndPensionFundTaxes(TestItEdi): cls.enasarco_sale_tax = find_tax_by_ref('enasarcov') cls.withholding_purchase_tax_23 = find_tax_by_ref('23awo') cls.enasarco_purchase_tax = find_tax_by_ref('enasarcoa') + cls.inps_tax = find_tax_by_ref('4vinps') + + cls.zero_tax = cls.env['account.tax'].with_company(cls.company).create({ + 'name': 'ZeroTax', + 'sequence': 31, + 'type_tax_use': 'sale', + 'amount': 0.0, + 'amount_type': 'percent', + 'l10n_it_exempt_reason': 'N2.2', + 'l10n_it_law_reference': 'Fatture emesse o ricevute da contribuenti forfettari o minimi', + }) cls.withholding_sale_line = { 'name': 'withholding_line', @@ -56,6 +67,12 @@ class TestWithholdingAndPensionFundTaxes(TestItEdi): ])] } + cls.inps_sale_line = { + 'name': 'inps_line', + 'quantity': 1, + 'tax_ids': [(6, 0, [cls.inps_tax.id, cls.zero_tax.id])] + } + invoice_data = cls.get_real_client_invoice_data() cls.withholding_tax_invoice = cls.env['account.move'].with_company(cls.company).create({ @@ -103,9 +120,25 @@ class TestWithholdingAndPensionFundTaxes(TestItEdi): ] }) + cls.inps_tax_invoice = cls.env['account.move'].with_company(cls.company).create({ + 'move_type': 'out_invoice', + 'company_id': cls.company.id, + 'partner_id': cls.italian_partner_a.id, + 'invoice_date': datetime.date(2022, 3, 24), + 'invoice_date_due': datetime.date(2022, 3, 24), + 'invoice_line_ids': [ + (0, 0, { + **cls.inps_sale_line, + 'name': name, + 'price_unit': price, + }) for (name, price) in invoice_data.lines + ] + }) + cls.withholding_tax_invoice._post() cls.pension_fund_tax_invoice._post() cls.enasarco_tax_invoice._post() + cls.inps_tax_invoice._post() cls.module = 'l10n_it_edi_withholding' @@ -261,3 +294,20 @@ class TestWithholdingAndPensionFundTaxes(TestItEdi): self.assertEqual(self.enasarco_purchase_tax, enasarco_imported_tax) self.assertEqual(-8.5, enasarco_imported_tax.amount) self.assertEqual(self.withholding_purchase_tax_23, line.tax_ids.filtered(lambda x: x.l10n_it_withholding_reason == 'ZO')) + + def test_inps_tax_export(self): + """ + Invoice + ----------------------------------------------------------------- + Ordinary accounting service for the year 350.00 + Balance deposit for the past year 300.00 + Ordinary accounting service for the trimester 50.00 + Electronic invoices management 50.00 + ----------------------------------------------------------------- + Total untaxed: 750.00 + VAT: 0% of Untaxed Amount 0.00 + INPS: 4% of Untaxed Amount 30.00 + Document total: Taxed Amount 780.00 + Payment amount: Document total 780.00 + """ + self._assert_export_invoice(self.inps_tax_invoice, 'inps_tax_invoice.xml')