Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion l10n_es_igic_verifactu_oca/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Comunicación Veri*FACTU IGIC
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:aa09bd59e94f22f5bdba1ffc12f57758c3966156c5c096d89883620b822fd9fd
!! source digest: sha256:5ef145abbf6cea266078510a1b9568e64b109afa634ea88962d84b05c7432a01
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -67,6 +67,7 @@ Contributors

- Mario Montes <[email protected]>
- Christian Ramos <[email protected]>
- Abraham J. Febres <[email protected]>

Maintainers
-----------
Expand Down
2 changes: 2 additions & 0 deletions l10n_es_igic_verifactu_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from . import models

from .hooks import post_init_hook
8 changes: 4 additions & 4 deletions l10n_es_igic_verifactu_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Comunicación Veri*FACTU IGIC",
"summary": "Comunicación Veri*FACTU para IGIC",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Accounting & Finance",
"website": "https://github.com/OCA/l10n-spain",
"author": "Binhex," "Odoo Community Association (OCA)",
Expand All @@ -17,9 +17,9 @@
"l10n_es_verifactu_oca",
],
"data": [
"data/atc_verifactu_map_data.xml",
"data/atc_verifactu_tax_agency_data.xml",
"data/account_fiscal_position_template_canary_data.xml",
"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",
}

This file was deleted.

44 changes: 0 additions & 44 deletions l10n_es_igic_verifactu_oca/data/atc_verifactu_map_data.xml

This file was deleted.

11 changes: 11 additions & 0 deletions l10n_es_igic_verifactu_oca/data/l10n.es.aeat.map.tax.line.tax.csv
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions l10n_es_igic_verifactu_oca/data/verifactu.map.line.csv
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 3 additions & 5 deletions l10n_es_igic_verifactu_oca/hooks.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# Copyright 2025 Binhex - Christian Ramos
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, api


def post_init_hook(cr, registry):
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.
"""
env = api.Environment(cr, SUPERUSER_ID, {})
key = env.ref("l10n_es_verifactu_oca.verifactu_registration_keys_igic_01")
atc_agency = env.ref("l10n_es_aeat.aeat_tax_agency_canarias")
cr.execute(
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),
)
cr.execute(
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,),
Expand Down
1 change: 1 addition & 0 deletions l10n_es_igic_verifactu_oca/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_chart_template
14 changes: 14 additions & 0 deletions l10n_es_igic_verifactu_oca/models/account_chart_template.py
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions l10n_es_igic_verifactu_oca/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Mario Montes \<[email protected]\>
- Christian Ramos \<[email protected]\>
- Abraham J. Febres \<[email protected]\>
3 changes: 2 additions & 1 deletion l10n_es_igic_verifactu_oca/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Comunicación Veri*FACTU IGIC</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:aa09bd59e94f22f5bdba1ffc12f57758c3966156c5c096d89883620b822fd9fd
!! source digest: sha256:5ef145abbf6cea266078510a1b9568e64b109afa634ea88962d84b05c7432a01
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_igic_verifactu_oca"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_igic_verifactu_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Módulo para la adaptación de la comunicación con el servicio Veri*FACTU
Expand Down Expand Up @@ -413,6 +413,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li>Mario Montes &lt;<a class="reference external" href="mailto:m.montes&#64;binhex.cloud">m.montes&#64;binhex.cloud</a>&gt;</li>
<li>Christian Ramos &lt;<a class="reference external" href="mailto:c.ramos&#64;binhex.cloud">c.ramos&#64;binhex.cloud</a>&gt;</li>
<li>Abraham J. Febres &lt;<a class="reference external" href="mailto:a.febres&#64;binhex.cloud">a.febres&#64;binhex.cloud</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
19 changes: 10 additions & 9 deletions l10n_es_igic_verifactu_oca/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class TestVerifactuIgicCommon(TestVerifactuCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.fp_nacional = cls.env.ref(f"l10n_es_igic.{cls.company.id}_fp_canary")
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"l10n_es_igic.{cls.company.id}_fp_recargo_canary")
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(
Expand All @@ -28,7 +28,8 @@ def _create_test_company(

Args:
name: Company name
vat: Company VAT number (must be in valid Spanish format without country code)
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

Expand All @@ -39,10 +40,9 @@ def _create_test_company(
{"name": name, "vat": vat, "country_id": self.env.ref("base.es").id}
)
if not company.chart_template_id:
coa = self.env.ref(
"l10n_es_igic.account_chart_template_pymes_canary", False
self.env["account.chart.template"].try_loading(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta fórmula es problemática, al menos en 18. Mira si esto otro sirve ya también en 17 y así ya no hay que cambiarlo luego:

chart._load(template_code="es_pymes", company=company, install_demo=False)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajfebres Revisa lo que comenta Pedro y realiza las pruebas.

"es_pymes_canary", company=company
)
coa.try_loading(company=company, install_demo=False)
company.write(
{
"verifactu_enabled": verifactu_enabled,
Expand All @@ -60,12 +60,13 @@ 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.chart = cls.env.ref("l10n_es_igic.account_chart_template_pymes_canary")
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.ref("l10n_es_igic.account_chart_template_pymes_canary")
chart.try_loading()
chart = cls.env["account.chart.template"]
chart.try_loading(
template_code="es_pymes_canary", company=cls.company, install_demo=False
)
cls.with_context(company_id=cls.company.id)
return True
26 changes: 2 additions & 24 deletions l10n_es_igic_verifactu_oca/tests/test_10n_es_igic_verifactu.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,11 @@ class TestL10nEsAeatVerifactuIgic(TestVerifactuIgicCommon):
def test_verifactu_hash_code(self):
TestL10nEsAeatVerifactu.test_verifactu_hash_code(self)

# This function override is needed because the company id is dynamic
# so if we introduce the hole tax xmlid it will fail in finding the
# JSON file like l10n_es_igic.3_account_tax_template_igic_r_3
def _create_and_test_invoice_verifactu_dict(
self, name, inv_type, lines, extra_vals, module=None
):
vals = []
tax_names = []
for line in lines:
taxes = self.env["account.tax"]
for tax in line[1]:
if "." in tax:
xml_id = tax
else:
xml_id = "l10n_es_igic.{}_account_tax_template_{}".format(
self.company.id, tax
)
taxes += self.env.ref(xml_id)
tax_names.append(tax)
vals.append({"price_unit": line[0], "taxes": taxes})
return self._compare_verifactu_dict(
"verifactu_{}_{}_dict.json".format(inv_type, "_".join(tax_names)),
name,
inv_type,
vals,
extra_vals=extra_vals,
module=module,
return TestL10nEsAeatVerifactu._create_and_test_invoice_verifactu_dict(
self, name, inv_type, lines, extra_vals, module
)

def test_get_verifactu_invoice_data(self):
Expand Down
Loading