diff --git a/l10n_es_igic_verifactu_oca/README.rst b/l10n_es_igic_verifactu_oca/README.rst new file mode 100644 index 00000000000..d8cf3fa34cf --- /dev/null +++ b/l10n_es_igic_verifactu_oca/README.rst @@ -0,0 +1,87 @@ +============================ +Comunicación Veri*FACTU IGIC +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5ef145abbf6cea266078510a1b9568e64b109afa634ea88962d84b05c7432a01 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github + :target: https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_igic_verifactu_oca + :alt: OCA/l10n-spain +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_igic_verifactu_oca + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Módulo para la adaptación de la comunicación con el servicio Veri*FACTU +de los impuestos de Canarias (IGIC). + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Antes de instalar este módulo, asegúrese de tener configurada la agencia +fiscal de Canarias en la configuración de la empresa. Esto es necesario +para la correcta asignación del tipo de impuesto "03" (IGIC) tanto en +las facturas como en las posiciones fiscales. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Binhex + +Contributors +------------ + +- Mario Montes +- Christian Ramos +- Abraham J. Febres + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/l10n-spain `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_es_igic_verifactu_oca/__init__.py b/l10n_es_igic_verifactu_oca/__init__.py new file mode 100644 index 00000000000..f21540f6c9c --- /dev/null +++ b/l10n_es_igic_verifactu_oca/__init__.py @@ -0,0 +1,3 @@ +from . import models + +from .hooks import post_init_hook diff --git a/l10n_es_igic_verifactu_oca/__manifest__.py b/l10n_es_igic_verifactu_oca/__manifest__.py new file mode 100644 index 00000000000..67e02aab43e --- /dev/null +++ b/l10n_es_igic_verifactu_oca/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright 2025 Binhex - Mario Montes +# Copyright 2025 Binhex - Christian Ramos +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Comunicación Veri*FACTU IGIC", + "summary": "Comunicación Veri*FACTU para IGIC", + "version": "17.0.1.0.0", + "category": "Accounting & Finance", + "website": "https://github.com/OCA/l10n-spain", + "author": "Binhex," "Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "l10n_es_igic", + "l10n_es_verifactu_oca", + ], + "data": [ + "data/verifactu_tax_agency_data.xml", + "data/l10n.es.aeat.map.tax.line.tax.csv", + "data/verifactu.map.line.csv", + ], + "post_init_hook": "post_init_hook", +} diff --git a/l10n_es_igic_verifactu_oca/data/l10n.es.aeat.map.tax.line.tax.csv b/l10n_es_igic_verifactu_oca/data/l10n.es.aeat.map.tax.line.tax.csv new file mode 100644 index 00000000000..8d532042f46 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/data/l10n.es.aeat.map.tax.line.tax.csv @@ -0,0 +1,11 @@ +id,name +igic_r_0,account_tax_template_igic_r_0 +igic_r_3,account_tax_template_igic_r_3 +igic_r_5,account_tax_template_igic_r_5 +igic_r_7,account_tax_template_igic_r_7 +igic_r_9_5,account_tax_template_igic_r_9_5 +igic_r_15,account_tax_template_igic_r_15 +igic_r_20,account_tax_template_igic_r_20 +igic_s_ISP0,account_tax_template_igic_s_ISP0 +igic_re_ex,account_tax_template_igic_re_ex +igic_ex_0,account_tax_template_igic_ex_0 diff --git a/l10n_es_igic_verifactu_oca/data/template/account.fiscal.position-es_common.csv b/l10n_es_igic_verifactu_oca/data/template/account.fiscal.position-es_common.csv new file mode 100644 index 00000000000..6be8c8ad9b2 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/data/template/account.fiscal.position-es_common.csv @@ -0,0 +1,9 @@ +id,verifactu_registration_key,verifactu_tax_key +"fp_canary","l10n_es_verifactu_oca.verifactu_registration_keys_igic_01","03" +"fp_extra_canary","l10n_es_verifactu_oca.verifactu_registration_keys_igic_02","03" +"fp_recargo_canary","l10n_es_verifactu_oca.verifactu_registration_keys_igic_18","03" +"fp_irpf9_canary","l10n_es_verifactu_oca.verifactu_registration_keys_igic_01","03" +"fp_irpf15_canary","l10n_es_verifactu_oca.verifactu_registration_keys_igic_01","03" +"fp_irpf19a_canary","l10n_es_verifactu_oca.verifactu_registration_keys_igic_01","03" +"fp_ispn_canary","l10n_es_verifactu_oca.verifactu_registration_keys_igic_01","03" +"fp_retailer_canary","l10n_es_verifactu_oca.verifactu_registration_keys_igic_17","03" diff --git a/l10n_es_igic_verifactu_oca/data/verifactu.map.line.csv b/l10n_es_igic_verifactu_oca/data/verifactu.map.line.csv new file mode 100644 index 00000000000..36850ebb698 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/data/verifactu.map.line.csv @@ -0,0 +1,4 @@ +id,code,name,tax_xmlid_ids:id,verifactu_map_id:id +"l10n_es_verifactu_oca.verifactu_map_line_S1","S1","Operación Sujeta y No exenta - Sin inversión del sujeto pasivo.","l10n_es_verifactu_oca.s_iva21b,l10n_es_verifactu_oca.s_iva0b,l10n_es_verifactu_oca.s_iva2b,l10n_es_verifactu_oca.s_iva4b,l10n_es_verifactu_oca.s_iva5b,l10n_es_verifactu_oca.s_iva7-5b,l10n_es_verifactu_oca.s_iva10b,l10n_es_verifactu_oca.s_iva21s,l10n_es_verifactu_oca.s_iva10s,l10n_es_verifactu_oca.s_iva0s,l10n_es_verifactu_oca.s_iva2s,l10n_es_verifactu_oca.s_iva4s,l10n_es_verifactu_oca.s_iva5s,l10n_es_verifactu_oca.s_iva7-5s,l10n_es_verifactu_oca.s_iva0_g_i,l10n_es_verifactu_oca.s_iva0_sp_i,l10n_es_verifactu_oca.s_iva0_g_e,l10n_es_verifactu_oca.s_iva_e,l10n_es_verifactu_oca.s_iva0_e,igic_r_0,igic_r_3,igic_r_5,igic_r_7,igic_r_9_5,igic_r_15,igic_r_20","l10n_es_verifactu_oca.verifactu_map" +"l10n_es_verifactu_oca.verifactu_map_line_S2","S2","Operación Sujeta y No exenta - Con Inversión del sujeto pasivo","l10n_es_verifactu_oca.s_iva0_isp,igic_s_ISP0","l10n_es_verifactu_oca.verifactu_map" +"verifactu_map_line_E1_igic","E1","Operaciones Exentas.","igic_re_ex,igic_ex_0","l10n_es_verifactu_oca.verifactu_map" diff --git a/l10n_es_igic_verifactu_oca/data/verifactu_tax_agency_data.xml b/l10n_es_igic_verifactu_oca/data/verifactu_tax_agency_data.xml new file mode 100644 index 00000000000..3efc2da0ec8 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/data/verifactu_tax_agency_data.xml @@ -0,0 +1,17 @@ + + + + https://prewww2.aeat.es/static_files/common/internet/dep/aplicaciones/es/aeat/tikeV1.0/cont/ws/SistemaFacturacion.wsdl + https://prewww1.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP + https://www2.agenciatributaria.gob.es/wlpl/TIKE-CONT/ValidarQR + https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR + + diff --git a/l10n_es_igic_verifactu_oca/hooks.py b/l10n_es_igic_verifactu_oca/hooks.py new file mode 100644 index 00000000000..5d808cdc5c0 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/hooks.py @@ -0,0 +1,22 @@ +# Copyright 2025 Binhex - Christian Ramos +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +def post_init_hook(env): + """Perform the reinitialization of this column based on the company's tax agency + WARNING: Only 03 case is covered here, so existing export/intra-community/other + invoices should be changed later. + """ + key = env.ref("l10n_es_verifactu_oca.verifactu_registration_keys_igic_01") + atc_agency = env.ref("l10n_es_aeat.aeat_tax_agency_canarias") + env.cr.execute( + "UPDATE account_move SET verifactu_registration_key = %s " + "WHERE move_type = 'out_refund' AND company_id in " + "(SELECT id FROM res_company where tax_agency_id = %s)", + (key.id, atc_agency.id), + ) + env.cr.execute( + "UPDATE account_fiscal_position SET verifactu_tax_key = '03' " + "WHERE company_id in (SELECT id FROM res_company where tax_agency_id = %s)", + (atc_agency.id,), + ) diff --git a/l10n_es_igic_verifactu_oca/models/__init__.py b/l10n_es_igic_verifactu_oca/models/__init__.py new file mode 100644 index 00000000000..f8b66874852 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/models/__init__.py @@ -0,0 +1 @@ +from . import account_chart_template diff --git a/l10n_es_igic_verifactu_oca/models/account_chart_template.py b/l10n_es_igic_verifactu_oca/models/account_chart_template.py new file mode 100644 index 00000000000..cc13f97f321 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/models/account_chart_template.py @@ -0,0 +1,14 @@ +from odoo import models + +from odoo.addons.account.models.chart_template import template + + +class AccountChartTemplate(models.AbstractModel): + _inherit = "account.chart.template" + + @template("es_common", "account.fiscal.position") + def _get_es_common_igic_account_fiscal_position(self): + res = self._parse_csv( + "es_common", "account.fiscal.position", module="l10n_es_igic_verifactu_oca" + ) + return res diff --git a/l10n_es_igic_verifactu_oca/pyproject.toml b/l10n_es_igic_verifactu_oca/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/l10n_es_igic_verifactu_oca/readme/CONTRIBUTORS.md b/l10n_es_igic_verifactu_oca/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..a648c809d71 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Mario Montes \ +- Christian Ramos \ +- Abraham J. Febres \ diff --git a/l10n_es_igic_verifactu_oca/readme/DESCRIPTION.md b/l10n_es_igic_verifactu_oca/readme/DESCRIPTION.md new file mode 100644 index 00000000000..56e5d97132f --- /dev/null +++ b/l10n_es_igic_verifactu_oca/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +Módulo para la adaptación de la comunicación con el servicio Veri\*FACTU +de los impuestos de Canarias (IGIC). diff --git a/l10n_es_igic_verifactu_oca/readme/USAGE.md b/l10n_es_igic_verifactu_oca/readme/USAGE.md new file mode 100644 index 00000000000..9e87868ab5a --- /dev/null +++ b/l10n_es_igic_verifactu_oca/readme/USAGE.md @@ -0,0 +1,4 @@ +Antes de instalar este módulo, asegúrese de tener configurada la agencia +fiscal de Canarias en la configuración de la empresa. Esto es necesario +para la correcta asignación del tipo de impuesto "03" (IGIC) tanto en +las facturas como en las posiciones fiscales. diff --git a/l10n_es_igic_verifactu_oca/static/description/index.html b/l10n_es_igic_verifactu_oca/static/description/index.html new file mode 100644 index 00000000000..bc8a125d799 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/static/description/index.html @@ -0,0 +1,434 @@ + + + + + +Comunicación Veri*FACTU IGIC + + + +
+

Comunicación Veri*FACTU IGIC

+ + +

Beta License: AGPL-3 OCA/l10n-spain Translate me on Weblate Try me on Runboat

+

Módulo para la adaptación de la comunicación con el servicio Veri*FACTU +de los impuestos de Canarias (IGIC).

+

Table of contents

+ +
+

Usage

+

Antes de instalar este módulo, asegúrese de tener configurada la agencia +fiscal de Canarias en la configuración de la empresa. Esto es necesario +para la correcta asignación del tipo de impuesto “03” (IGIC) tanto en +las facturas como en las posiciones fiscales.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Binhex
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/l10n-spain project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/l10n_es_igic_verifactu_oca/tests/__init__.py b/l10n_es_igic_verifactu_oca/tests/__init__.py new file mode 100644 index 00000000000..b8c491af3a5 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/tests/__init__.py @@ -0,0 +1 @@ +from . import test_10n_es_igic_verifactu diff --git a/l10n_es_igic_verifactu_oca/tests/common.py b/l10n_es_igic_verifactu_oca/tests/common.py new file mode 100644 index 00000000000..e572c2dbaa3 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/tests/common.py @@ -0,0 +1,73 @@ +# Copyright 2025 Binhex - Christian Ramos +from odoo.addons.l10n_es_verifactu_oca.tests.common import TestVerifactuCommon + + +class TestVerifactuIgicCommon(TestVerifactuCommon): + """Common base class for VeriFactu tests with shared setup and utilities.""" + + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.fp_nacional = cls.env.ref(f"account.{cls.company.id}_fp_canary") + cls.fp_registration_key_01 = cls.env.ref( + "l10n_es_verifactu_oca.verifactu_registration_keys_igic_01" + ) + cls.fp_nacional.verifactu_registration_key = cls.fp_registration_key_01 + cls.fp_nacional.verifactu_tax_key = "03" # IGIC" + cls.fp_recargo = cls.env.ref(f"account.{cls.company.id}_fp_recargo_canary") + cls.fp_recargo.verifactu_registration_key = cls.fp_registration_key_01 + + def _create_test_company( + self, + name="Test Company", + vat="B87654321", + verifactu_enabled=True, + ): + """ + Helper method to create a test company configured for verifactu. + + Args: + name: Company name + vat: Company VAT number (must be in valid Spanish format + without country code) + verifactu_enabled: Enable verifactu for the company + verifactu_test: Set verifactu test mode + + Returns: + res.company: Created company record + """ + company = self.env["res.company"].create( + {"name": name, "vat": vat, "country_id": self.env.ref("base.es").id} + ) + if not company.chart_template_id: + chart = self.env["account.chart.template"] + chart._load( + template_code="es_pymes_canary", company=company, install_demo=False + ) + company.write( + { + "verifactu_enabled": verifactu_enabled, + "verifactu_test": True, + "tax_agency_id": self.env.ref( + "l10n_es_aeat.aeat_tax_agency_canarias" + ).id, + "verifactu_developer_id": self.verifactu_developer.id, + } + ) + return company + + @classmethod + def _chart_of_accounts_create(cls): + cls.company = cls.env["res.company"].create( + {"name": "Spanish test company", "currency_id": cls.env.ref("base.EUR").id} + ) + cls.env.ref("base.group_multi_company").write({"users": [(4, cls.env.uid)]}) + cls.env.user.write( + {"company_ids": [(4, cls.company.id)], "company_id": cls.company.id} + ) + chart = cls.env["account.chart.template"] + chart._load( + template_code="es_pymes_canary", company=cls.company, install_demo=False + ) + cls.with_context(company_id=cls.company.id) + return True diff --git a/l10n_es_igic_verifactu_oca/tests/json/verifactu_out_invoice_igic_r_3_igic_r_7_dict.json b/l10n_es_igic_verifactu_oca/tests/json/verifactu_out_invoice_igic_r_3_igic_r_7_dict.json new file mode 100644 index 00000000000..47d642ea606 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/tests/json/verifactu_out_invoice_igic_r_3_igic_r_7_dict.json @@ -0,0 +1,59 @@ +{ + "RegistroAlta": { + "IDVersion": 1.0, + "IDFactura": { + "IDEmisorFactura": "G87846952", + "NumSerieFactura": "TEST001", + "FechaExpedicionFactura": "01-01-2026" + }, + "NombreRazonEmisor": "Spanish test company", + "TipoFactura": "F1", + "DescripcionOperacion": "/", + "Destinatarios": { + "IDDestinatario": { + "NombreRazon": "Test partner", + "NIF": "89890001K" + } + }, + "Desglose": { + "DetalleDesglose": [ + { + "Impuesto": "03", + "ClaveRegimen": "01", + "CalificacionOperacion": "S1", + "TipoImpositivo": "3.0", + "BaseImponibleOimporteNoSujeto": 100.0, + "CuotaRepercutida": 3.0 + }, + { + "Impuesto": "03", + "ClaveRegimen": "01", + "CalificacionOperacion": "S1", + "TipoImpositivo": "7.0", + "BaseImponibleOimporteNoSujeto": 200.0, + "CuotaRepercutida": 14.0 + } + ] + }, + "CuotaTotal": 17.0, + "ImporteTotal": 317.0, + "Encadenamiento": { + "PrimerRegistro": "S" + }, + "SistemaInformatico": { + "NombreRazon": "Odoo Developer", + "NIF": "A12345674", + "NombreSistemaInformatico": "odoo", + "IdSistemaInformatico": "11", + "Version": "1.0", + "NumeroInstalacion": 1, + "TipoUsoPosibleSoloVerifactu": "S", + "TipoUsoPosibleMultiOT": "S", + "IndicadorMultiplesOT": "N", + "IDOtro": { + "IDType": "", + "ID": "" + } + } + } +} diff --git a/l10n_es_igic_verifactu_oca/tests/json/verifactu_out_refund_igic_r_3_igic_r_3_igic_r_7_dict.json b/l10n_es_igic_verifactu_oca/tests/json/verifactu_out_refund_igic_r_3_igic_r_3_igic_r_7_dict.json new file mode 100644 index 00000000000..7b5bfb2f1e1 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/tests/json/verifactu_out_refund_igic_r_3_igic_r_3_igic_r_7_dict.json @@ -0,0 +1,66 @@ +{ + "RegistroAlta": { + "IDVersion": 1.0, + "IDFactura": { + "IDEmisorFactura": "G87846952", + "NumSerieFactura": "TEST002", + "FechaExpedicionFactura": "01-01-2026" + }, + "NombreRazonEmisor": "Spanish test company", + "TipoFactura": "R1", + "TipoRectificativa": "I", + "DescripcionOperacion": "/", + "Destinatarios": { + "IDDestinatario": { + "NombreRazon": "Test partner", + "NIF": "89890001K" + } + }, + "Desglose": { + "DetalleDesglose": [ + { + "Impuesto": "03", + "ClaveRegimen": "01", + "CalificacionOperacion": "S1", + "TipoImpositivo": "3.0", + "BaseImponibleOimporteNoSujeto": -200.0, + "CuotaRepercutida": -6.0 + }, + { + "Impuesto": "03", + "ClaveRegimen": "01", + "CalificacionOperacion": "S1", + "TipoImpositivo": "7.0", + "BaseImponibleOimporteNoSujeto": -200.0, + "CuotaRepercutida": -14.0 + } + ] + }, + "CuotaTotal": -20.0, + "ImporteTotal": -420.0, + "Encadenamiento": { + "RegistroAnterior": { + "FechaExpedicionFactura": "01-01-2026", + "Huella": "E687B895402BC9258D24C79401783149C9250884EB89F2184926E5B56A8E6F85", + "IDEmisorFactura": "G87846952", + "NumSerieFactura": "TEST001" + } + }, + "FacturasRectificadas": [], + "SistemaInformatico": { + "NombreRazon": "Odoo Developer", + "NIF": "A12345674", + "NombreSistemaInformatico": "odoo", + "IdSistemaInformatico": "11", + "Version": "1.0", + "NumeroInstalacion": 1, + "TipoUsoPosibleSoloVerifactu": "S", + "TipoUsoPosibleMultiOT": "S", + "IndicadorMultiplesOT": "N", + "IDOtro": { + "IDType": "", + "ID": "" + } + } + } +} diff --git a/l10n_es_igic_verifactu_oca/tests/test_10n_es_igic_verifactu.py b/l10n_es_igic_verifactu_oca/tests/test_10n_es_igic_verifactu.py new file mode 100644 index 00000000000..43d0cff1a77 --- /dev/null +++ b/l10n_es_igic_verifactu_oca/tests/test_10n_es_igic_verifactu.py @@ -0,0 +1,58 @@ +# Copyright 2025 Binhex - Christian Ramos +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) +from odoo.addons.l10n_es_verifactu_oca.tests.test_10n_es_verifactu import ( + TestL10nEsAeatVerifactu, +) + +from .common import TestVerifactuIgicCommon + + +class TestL10nEsAeatVerifactuIgic(TestVerifactuIgicCommon): + def test_verifactu_hash_code(self): + TestL10nEsAeatVerifactu.test_verifactu_hash_code(self) + + def _create_and_test_invoice_verifactu_dict( + self, name, inv_type, lines, extra_vals, module=None + ): + return TestL10nEsAeatVerifactu._create_and_test_invoice_verifactu_dict( + self, name, inv_type, lines, extra_vals, module + ) + + def test_get_verifactu_invoice_data(self): + mapping = [ + ( + "TEST001", + "out_invoice", + [(100, ["igic_r_3"]), (200, ["igic_r_7"])], + { + "fiscal_position_id": self.fp_nacional.id, + "verifactu_registration_key": self.fp_registration_key_01.id, + "verifactu_registration_date": "2026-01-01 19:20:30", + }, + ), + ( + "TEST002", + "out_refund", + [(100, ["igic_r_3"]), (100, ["igic_r_3"]), (200, ["igic_r_7"])], + { + "fiscal_position_id": self.fp_nacional.id, + "verifactu_registration_key": self.fp_registration_key_01.id, + "verifactu_registration_date": "2026-01-01 19:20:30", + }, + ), + ] + for name, inv_type, lines, extra_vals in mapping: + self._create_and_test_invoice_verifactu_dict( + name, inv_type, lines, extra_vals, "l10n_es_igic_verifactu_oca" + ) + return + + def _compare_verifactu_dict( + self, json_file, name, inv_type, lines, extra_vals=None, module=None + ): + return TestL10nEsAeatVerifactu._compare_verifactu_dict( + self, json_file, name, inv_type, lines, extra_vals, module + ) + + def test_verifactu_start_date(self): + TestL10nEsAeatVerifactu.test_verifactu_start_date(self)