diff --git a/l10n_es_aeat_mod303_oss/README.rst b/l10n_es_aeat_mod303_oss/README.rst new file mode 100644 index 00000000000..1c557681de0 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/README.rst @@ -0,0 +1,87 @@ +===================== +AEAT modelo 303 - OSS +===================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:3abc54568bd33c565f5ebe8e40ccdd96dd5aa2dd9a052e4b820b4539e410db9c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_aeat_mod303_oss + :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_aeat_mod303_oss + :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 ampliación del modelo 303 (IVA - Autodeclaración) para incluir +los datos de la ventanilla única o One-Stop Shop (OSS). + +**Table of contents** + +.. contents:: + :local: + +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 +------- + +* PESOL +* Tecnativa + +Contributors +------------ + +- Angel Moya +- Rodrigo Bonilla +- `Tecnativa `__: + + - Pedro M. Baeza + +- `Sygel `__: + + - Manuel Regidor + - Alberto Martínez + +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_aeat_mod303_oss/__init__.py b/l10n_es_aeat_mod303_oss/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/l10n_es_aeat_mod303_oss/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/l10n_es_aeat_mod303_oss/__manifest__.py b/l10n_es_aeat_mod303_oss/__manifest__.py new file mode 100644 index 00000000000..bed1744a47a --- /dev/null +++ b/l10n_es_aeat_mod303_oss/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2021 PESOL - Angel Moya +# Copyright 2021 Tecnativa - Pedro M. Baeza +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0 + +{ + "name": "AEAT modelo 303 - OSS", + "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/2023/l10n.es.aeat.map.tax.line.csv", + "data/2024-10/l10n.es.aeat.map.tax.line.csv", + ], + "installable": True, + "autoinstall": True, +} diff --git a/l10n_es_aeat_mod303_oss/data/2023/l10n.es.aeat.map.tax.line.csv b/l10n_es_aeat_mod303_oss/data/2023/l10n.es.aeat.map.tax.line.csv new file mode 100644 index 00000000000..c1a2ee539a2 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/data/2023/l10n.es.aeat.map.tax.line.csv @@ -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,, diff --git a/l10n_es_aeat_mod303_oss/data/2024-10/l10n.es.aeat.map.tax.line.csv b/l10n_es_aeat_mod303_oss/data/2024-10/l10n.es.aeat.map.tax.line.csv new file mode 100644 index 00000000000..c8c81fc877f --- /dev/null +++ b/l10n_es_aeat_mod303_oss/data/2024-10/l10n.es.aeat.map.tax.line.csv @@ -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,, diff --git a/l10n_es_aeat_mod303_oss/data/2024-10/l10n_es_aeat_map_tax_line.xml b/l10n_es_aeat_mod303_oss/data/2024-10/l10n_es_aeat_map_tax_line.xml new file mode 100644 index 00000000000..3150d353a0b --- /dev/null +++ b/l10n_es_aeat_mod303_oss/data/2024-10/l10n_es_aeat_map_tax_line.xml @@ -0,0 +1,50 @@ + + + + + + 123 + Operaciones no sujetas por reglas de localización acogidas a la OSS + all + base + both + + + + + + 124 + OSS. Operaciones sujetas y acogidas a la OSS + all + base + both + + + + + + 126 + Operaciones no sujetas por reglas de localización acogidas a la OSS + all + base + both + + + + + + 127 + OSS. Operaciones sujetas y acogidas a la OSS + all + base + both + + + + diff --git a/l10n_es_aeat_mod303_oss/i18n/ca.po b/l10n_es_aeat_mod303_oss/i18n/ca.po new file mode 100644 index 00000000000..3ad2cc32dbc --- /dev/null +++ b/l10n_es_aeat_mod303_oss/i18n/ca.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_aeat_mod303_oss +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-05-19 18:05+0000\n" +"Last-Translator: jabelchi \n" +"Language-Team: none\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: l10n_es_aeat_mod303_oss +#: model:ir.model,name:l10n_es_aeat_mod303_oss.model_l10n_es_aeat_mod303_report +msgid "AEAT 303 Report" +msgstr "Informe AEAT 303" diff --git a/l10n_es_aeat_mod303_oss/i18n/ca_ES.po b/l10n_es_aeat_mod303_oss/i18n/ca_ES.po new file mode 100644 index 00000000000..4973f36d634 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/i18n/ca_ES.po @@ -0,0 +1,20 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_aeat_mod303_oss +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: ca_ES\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: l10n_es_aeat_mod303_oss +#: model:ir.model,name:l10n_es_aeat_mod303_oss.model_l10n_es_aeat_mod303_report +msgid "AEAT 303 Report" +msgstr "" diff --git a/l10n_es_aeat_mod303_oss/i18n/es.po b/l10n_es_aeat_mod303_oss/i18n/es.po new file mode 100644 index 00000000000..662fb005883 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/i18n/es.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_aeat_mod303_oss +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-07-31 10:08+0000\n" +"Last-Translator: gelo joga Rodríguez \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: l10n_es_aeat_mod303_oss +#: model:ir.model,name:l10n_es_aeat_mod303_oss.model_l10n_es_aeat_mod303_report +msgid "AEAT 303 Report" +msgstr "Informe AEAT 303" diff --git a/l10n_es_aeat_mod303_oss/i18n/l10n_es_aeat_mod303_oss.pot b/l10n_es_aeat_mod303_oss/i18n/l10n_es_aeat_mod303_oss.pot new file mode 100644 index 00000000000..61ed91aa39d --- /dev/null +++ b/l10n_es_aeat_mod303_oss/i18n/l10n_es_aeat_mod303_oss.pot @@ -0,0 +1,19 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_aeat_mod303_oss +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_es_aeat_mod303_oss +#: model:ir.model,name:l10n_es_aeat_mod303_oss.model_l10n_es_aeat_mod303_report +msgid "AEAT 303 Report" +msgstr "" diff --git a/l10n_es_aeat_mod303_oss/models/__init__.py b/l10n_es_aeat_mod303_oss/models/__init__.py new file mode 100644 index 00000000000..0a8d8a2ee5f --- /dev/null +++ b/l10n_es_aeat_mod303_oss/models/__init__.py @@ -0,0 +1,2 @@ +from . import l10n_es_aeat_map_tax_line +from . import mod303 diff --git a/l10n_es_aeat_mod303_oss/models/l10n_es_aeat_map_tax_line.py b/l10n_es_aeat_mod303_oss/models/l10n_es_aeat_map_tax_line.py new file mode 100644 index 00000000000..d815025d80b --- /dev/null +++ b/l10n_es_aeat_mod303_oss/models/l10n_es_aeat_map_tax_line.py @@ -0,0 +1,27 @@ +# Copyright 2021 PESOL - Angel Moya +# Copyright 2021 FactorLibre - Rodrigo Bonilla +# 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) diff --git a/l10n_es_aeat_mod303_oss/models/mod303.py b/l10n_es_aeat_mod303_oss/models/mod303.py new file mode 100644 index 00000000000..c90ce1b2196 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/models/mod303.py @@ -0,0 +1,34 @@ +# Copyright 2021 PESOL - Angel Moya +# Copyright 2021 FactorLibre - Rodrigo Bonilla +# Copyright 2021 Tecnativa - Pedro M. Baeza +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0 + +from odoo import models + + +class L10nEsAeatMod303Report(models.Model): + _inherit = "l10n.es.aeat.mod303.report" + + 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. + """ + res = super()._get_tax_lines(date_start, date_end, map_line) + if map_line.field_number in (126, 127): + if ( + self.exonerated_390 == "2" + or not self.has_operation_volume + or self.period_type not in ("4T", "12") + ): + return self.env["account.move.line"] + return res + + def _get_move_line_domain(self, date_start, date_end, map_line): + """Change dates to full year when the summary on last report of the year for the + corresponding fields. Only field number is checked as the complete check for not + bringing results is done on `_get_tax_lines`. + """ + if map_line.field_number in (126, 127): + date_start = date_start.replace(day=1, month=1) + date_end = date_end.replace(day=31, month=12) + return super()._get_move_line_domain(date_start, date_end, map_line) diff --git a/l10n_es_aeat_mod303_oss/pyproject.toml b/l10n_es_aeat_mod303_oss/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/l10n_es_aeat_mod303_oss/readme/CONTRIBUTORS.md b/l10n_es_aeat_mod303_oss/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..cd56c0958b7 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- Angel Moya \<\> +- Rodrigo Bonilla \<\> +- [Tecnativa](https://www.tecnativa.com): + - Pedro M. Baeza +- [Sygel](https://www.sygel.es): + - Manuel Regidor + - Alberto Martínez diff --git a/l10n_es_aeat_mod303_oss/readme/DESCRIPTION.md b/l10n_es_aeat_mod303_oss/readme/DESCRIPTION.md new file mode 100644 index 00000000000..a07e090b19f --- /dev/null +++ b/l10n_es_aeat_mod303_oss/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +Módulo ampliación del modelo 303 (IVA - Autodeclaración) para incluir +los datos de la ventanilla única o One-Stop Shop (OSS). diff --git a/l10n_es_aeat_mod303_oss/static/description/icon.png b/l10n_es_aeat_mod303_oss/static/description/icon.png new file mode 100644 index 00000000000..8295808f223 Binary files /dev/null and b/l10n_es_aeat_mod303_oss/static/description/icon.png differ diff --git a/l10n_es_aeat_mod303_oss/static/description/icon_source.svg b/l10n_es_aeat_mod303_oss/static/description/icon_source.svg new file mode 100644 index 00000000000..94549c572c1 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/static/description/icon_source.svg @@ -0,0 +1,113 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + 303 + OSS + diff --git a/l10n_es_aeat_mod303_oss/static/description/index.html b/l10n_es_aeat_mod303_oss/static/description/index.html new file mode 100644 index 00000000000..bd5645d47a6 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/static/description/index.html @@ -0,0 +1,435 @@ + + + + + +AEAT modelo 303 - OSS + + + +
+

AEAT modelo 303 - OSS

+ + +

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

+

Módulo ampliación del modelo 303 (IVA - Autodeclaración) para incluir +los datos de la ventanilla única o One-Stop Shop (OSS).

+

Table of contents

+ +
+

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

+
    +
  • PESOL
  • +
  • Tecnativa
  • +
+
+
+

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_aeat_mod303_oss/tests/__init__.py b/l10n_es_aeat_mod303_oss/tests/__init__.py new file mode 100644 index 00000000000..dfb8e8b929d --- /dev/null +++ b/l10n_es_aeat_mod303_oss/tests/__init__.py @@ -0,0 +1 @@ +from . import test_l10n_es_aeat_mod303_oss diff --git a/l10n_es_aeat_mod303_oss/tests/test_l10n_es_aeat_mod303_oss.py b/l10n_es_aeat_mod303_oss/tests/test_l10n_es_aeat_mod303_oss.py new file mode 100644 index 00000000000..ff795c5ce30 --- /dev/null +++ b/l10n_es_aeat_mod303_oss/tests/test_l10n_es_aeat_mod303_oss.py @@ -0,0 +1,96 @@ +# Copyright 2021 Tecnativa - Pedro M. Baeza +# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0 + + +from odoo.tests.common import Form + +from odoo.addons.l10n_es_aeat_mod303.tests.test_l10n_es_aeat_mod303 import ( + TestL10nEsAeatMod303Base, +) + + +class TestL10nEsAeatMod303(TestL10nEsAeatMod303Base): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) + cls.oss_country = cls.env.ref("base.fr") + cls.company.country_id = cls.env.ref("base.es").id + cls.company.account_fiscal_country_id = cls.env.ref("base.es").id + general_tax = cls.env.ref( + "account.%s_account_tax_template_s_iva21b" % cls.company.id + ) + wizard = cls.env["l10n.eu.oss.wizard"].create( + { + "company_id": cls.company.id, + "general_tax": general_tax.id, + "todo_country_ids": [(4, cls.oss_country.id)], + } + ) + wizard.generate_eu_oss_taxes() + cls.fr_fiscal_position = cls.env["account.fiscal.position"].search( + [("country_id", "=", cls.oss_country.id), ("oss_oca", "=", True)], limit=1 + ) + cls.taxes_sale = {} + cls.oss_tax = cls.env["account.tax"].search( + [ + ("oss_country_id", "=", cls.oss_country.id), + ("company_id", "=", cls.company.id), + ] + ) + line_data = { + "name": "Test for OSS tax", + "account_id": cls.accounts["700000"].id, + "price_unit": 100, + "quantity": 1, + "tax_ids": [(4, cls.oss_tax.id)], + } + extra_vals = { + "invoice_line_ids": [(0, 0, line_data)], + "fiscal_position_id": cls.fr_fiscal_position.id, + } + 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"], + view="l10n_es_aeat_mod303.view_l10n_es_aeat_mod303_report_form", + ) + mod303_form.company_id = cls.company + mod303_form.year = 2023 + mod303_form.period_type = "1T" + mod303_form.company_vat = "1234567890" + 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": "2023-10-01", + "date_end": "2023-12-31", + } + ) + + def _check_field_amount(self, report, number, amount): + lines = report.tax_line_ids.filtered(lambda x: x.field_number == number) + self.assertAlmostEqual(sum(lines.mapped("amount")), amount) + + def test_l10n_es_aeat_mod303_oss(self): + self.assertEqual(self.invoice_1.fiscal_position_id, self.fr_fiscal_position) + self.assertEqual(self.invoice_2.fiscal_position_id, self.fr_fiscal_position) + self.model303.button_calculate() + self._check_field_amount(self.model303, 123, 100) + self._check_field_amount(self.model303, 126, 0) + self.model303_4t.button_calculate() + self._check_field_amount(self.model303_4t, 123, 100) + self._check_field_amount(self.model303_4t, 126, 200)