Skip to content

Commit

Permalink
[MIG] l10n_es_aeat_mod303_oss: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tisho99 committed Feb 19, 2025
1 parent 7c14e0c commit bf5c8bd
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 130 deletions.
1 change: 1 addition & 0 deletions l10n_es_aeat_mod303_oss/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Contributors
- `Sygel <https://www.sygel.es>`__:

- Manuel Regidor
- Alberto Martínez

Maintainers
-----------
Expand Down
7 changes: 3 additions & 4 deletions l10n_es_aeat_mod303_oss/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

{
"name": "AEAT modelo 303 - OSS",
"version": "16.0.1.1.0",
"version": "17.0.1.1.0",
"category": "Accounting",
"author": "PESOL, Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-spain",
"license": "AGPL-3",
"depends": ["l10n_es_aeat_mod303", "l10n_eu_oss_oca"],
"data": [
"data/2021-07/l10n_es_aeat_map_tax_line.xml",
"data/2023/l10n_es_aeat_map_tax_line.xml",
"data/2024-10/l10n_es_aeat_map_tax_line.xml",
"data/2023/l10n.es.aeat.map.tax.line.csv",
"data/2024-10/l10n.es.aeat.map.tax.line.csv",
],
"installable": True,
"autoinstall": True,
Expand Down
50 changes: 0 additions & 50 deletions l10n_es_aeat_mod303_oss/data/2021-07/l10n_es_aeat_map_tax_line.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,field_number,field_type,inverse,map_parent_id:id,move_type,name,sum_type,account_xmlid_ids/id,tax_xmlid_ids/id
aeat_mod303_2023_map_line_123,123,base,,l10n_es_aeat_mod303.aeat_mod303_2023_map,all,Operaciones no sujetas por reglas de localización acogidas a la OSS,both,,
aeat_mod303_2023_map_line_124,124,base,,l10n_es_aeat_mod303.aeat_mod303_2023_map,all,OSS. Operaciones sujetas y acogidas a la OSS,both,,
aeat_mod303_2023_map_line_126,126,base,,l10n_es_aeat_mod303.aeat_mod303_2023_map,all,Operaciones no sujetas por reglas de localización acogidas a la OSS,both,,
aeat_mod303_2023_map_line_127,127,base,,l10n_es_aeat_mod303.aeat_mod303_2023_map,all,OSS. Operaciones sujetas y acogidas a la OSS,both,,
50 changes: 0 additions & 50 deletions l10n_es_aeat_mod303_oss/data/2023/l10n_es_aeat_map_tax_line.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,field_number,field_type,inverse,map_parent_id:id,move_type,name,sum_type,account_xmlid_ids/id,tax_xmlid_ids/id
aeat_mod303_2024_10_map_line_123,123,base,,l10n_es_aeat_mod303.aeat_mod303_2024_10_map,all,Operaciones no sujetas por reglas de localización acogidas a la OSS,both,,
aeat_mod303_2024_10_map_line_124,124,base,,l10n_es_aeat_mod303.aeat_mod303_2024_10_map,all,OSS. Operaciones sujetas y acogidas a la OSS,both,,
aeat_mod303_2024_10_map_line_126,126,base,,l10n_es_aeat_mod303.aeat_mod303_2024_10_map,all,Operaciones no sujetas por reglas de localización acogidas a la OSS,both,,
aeat_mod303_2024_10_map_line_127,127,base,,l10n_es_aeat_mod303.aeat_mod303_2024_10_map,all,OSS. Operaciones sujetas y acogidas a la OSS,both,,
1 change: 1 addition & 0 deletions l10n_es_aeat_mod303_oss/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import l10n_es_aeat_map_tax_line
from . import mod303
27 changes: 27 additions & 0 deletions l10n_es_aeat_mod303_oss/models/l10n_es_aeat_map_tax_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021 PESOL - Angel Moya
# Copyright 2021 FactorLibre - Rodrigo Bonilla <[email protected]>
# Copyright 2021 Tecnativa - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0

from odoo import models


class L10nEsAeatMapTaxLine(models.Model):
_inherit = "l10n.es.aeat.map.tax.line"

def get_taxes_for_company(self, company):
self.ensure_one()
oss_map_lines = [
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_2023_map_line_123"),
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_2023_map_line_126"),
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_2024_10_map_line_123"),
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_2024_10_map_line_126"),
]
if self in oss_map_lines:
return self.env["account.tax"].search(
[
("oss_country_id", "!=", False),
("company_id", "=", company.id),
]
)
return super().get_taxes_for_company(company)
18 changes: 0 additions & 18 deletions l10n_es_aeat_mod303_oss/models/mod303.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,6 @@
class L10nEsAeatMod303Report(models.Model):
_inherit = "l10n.es.aeat.mod303.report"

def get_taxes_from_map(self, map_line):
oss_map_lines = [
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_202107_map_line_123"),
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_202107_map_line_126"),
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_2023_map_line_123"),
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_2023_map_line_126"),
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_2024_10_map_line_123"),
self.env.ref("l10n_es_aeat_mod303_oss.aeat_mod303_2024_10_map_line_126"),
]
if map_line in oss_map_lines:
return self.env["account.tax"].search(
[
("oss_country_id", "!=", False),
("company_id", "=", self.company_id.id),
]
)
return super().get_taxes_from_map(map_line)

def _get_tax_lines(self, date_start, date_end, map_line):
"""Don't populate results for fields 126-127 for reports different from
last of the year one or when not exonerated of presenting model 390.
Expand Down
1 change: 1 addition & 0 deletions l10n_es_aeat_mod303_oss/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
- Pedro M. Baeza
- [Sygel](https://www.sygel.es):
- Manuel Regidor
- Alberto Martínez
1 change: 1 addition & 0 deletions l10n_es_aeat_mod303_oss/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
</li>
<li><a class="reference external" href="https://www.sygel.es">Sygel</a>:<ul>
<li>Manuel Regidor</li>
<li>Alberto Martínez</li>
</ul>
</li>
</ul>
Expand Down
23 changes: 15 additions & 8 deletions l10n_es_aeat_mod303_oss/tests/test_l10n_es_aeat_mod303_oss.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2021 Tecnativa - Pedro M. Baeza
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0

import logging

from odoo.tests.common import Form

from odoo.addons.l10n_es_aeat_mod303.tests.test_l10n_es_aeat_mod303 import (
Expand All @@ -24,9 +26,10 @@ def setUpClass(cls):
)
cls.oss_country = cls.env.ref("base.fr")
cls.company.country_id = cls.env.ref("base.es").id
cls.company.phone = "-555-5555"
cls.company.account_fiscal_country_id = cls.env.ref("base.es").id
general_tax = cls.env.ref(
"l10n_es.%s_account_tax_template_s_iva21b" % cls.company.id
"account.%s_account_tax_template_s_iva21b" % cls.company.id
)
wizard = cls.env["l10n.eu.oss.wizard"].create(
{
Expand Down Expand Up @@ -57,23 +60,27 @@ def setUpClass(cls):
"invoice_line_ids": [(0, 0, line_data)],
"fiscal_position_id": cls.fr_fiscal_position.id,
}
cls.invoice_1 = cls._invoice_sale_create("2021-07-01", extra_vals)
cls.invoice_2 = cls._invoice_sale_create("2021-11-01", extra_vals)
cls.invoice_1 = cls._invoice_sale_create("2023-01-01", extra_vals)
cls.invoice_2 = cls._invoice_sale_create("2023-11-01", extra_vals)
# Create reports
mod303_form = Form(cls.env["l10n.es.aeat.mod303.report"])
mod303_form = Form(
cls.env["l10n.es.aeat.mod303.report"],
view="l10n_es_aeat_mod303.view_l10n_es_aeat_mod303_report_form",
)
mod303_form.company_id = cls.company
mod303_form.year = 2021
mod303_form.period_type = "3T"
mod303_form.year = 2023
mod303_form.period_type = "1T"
mod303_form.company_vat = "1234567890"
logging.error(f"mod303_form.contact_name: {mod303_form.contact_name}")
cls.model303 = mod303_form.save()
cls.model303_4t = cls.model303.copy(
{
"name": "OSS4000000303",
"exonerated_390": "1",
"has_operation_volume": True,
"period_type": "4T",
"date_start": "2021-10-01",
"date_end": "2021-12-31",
"date_start": "2023-10-01",
"date_end": "2023-12-31",
}
)

Expand Down

0 comments on commit bf5c8bd

Please sign in to comment.