diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/README.rst b/l10n_es_aeat_mod303_special_prorate_regularization/README.rst new file mode 100644 index 000000000..98c31f765 --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/README.rst @@ -0,0 +1,64 @@ +========================================= +AEAT 303 - Special Prorate Regularization +========================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:ebeb2963eab646a23fff570f53c3056bf62b83439e402ffa573d09abb6a1a3d3 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-NuoBiT%2Fodoo--addons-lightgray.png?logo=github + :target: https://github.com/NuoBiT/odoo-addons/tree/18.0/l10n_es_aeat_mod303_special_prorate_regularization + :alt: NuoBiT/odoo-addons + +|badge1| |badge2| |badge3| + +This module adds hooks and common methods for regularizations + +**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 +------- + +* NuoBiT Solutions SL + +Contributors +------------ + +- `NuoBiT `__: + + - Kilian Niubo kniubo@nuobit.com + - Eric Antones eantones@nuobit.com + - Deniz Gallo dgallo@nuobit.com + +Maintainers +----------- + +This module is part of the `NuoBiT/odoo-addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/__init__.py b/l10n_es_aeat_mod303_special_prorate_regularization/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/__manifest__.py b/l10n_es_aeat_mod303_special_prorate_regularization/__manifest__.py new file mode 100644 index 000000000..ee30f0272 --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright NuoBiT Solutions SL - Kilian Niubo +# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "AEAT 303 - Special Prorate Regularization", + "summary": "This module adds hooks and common methods for regularizations", + "version": "18.0.1.0.0", + "category": "Accounting", + "author": "NuoBiT Solutions SL", + "website": "https://github.com/NuoBiT/odoo-addons", + "license": "AGPL-3", + "depends": [ + "l10n_es_aeat_vat_special_prorrate", + "l10n_es_aeat_mod303", + ], +} diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/i18n/es.po b/l10n_es_aeat_mod303_special_prorate_regularization/i18n/es.po new file mode 100644 index 000000000..b78a8a88a --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/i18n/es.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_aeat_mod303_special_prorate_regularization +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-11-29 09:16+0000\n" +"PO-Revision-Date: 2026-02-26 00:00+0000\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_special_prorate_regularization +#: model:ir.model,name:l10n_es_aeat_mod303_special_prorate_regularization.model_l10n_es_aeat_mod303_report +msgid "AEAT 303 Report" +msgstr "Modelo AEAT 303" + +#. module: l10n_es_aeat_mod303_special_prorate_regularization +#: model:ir.model,name:l10n_es_aeat_mod303_special_prorate_regularization.model_l10n_es_aeat_report +msgid "AEAT report base module" +msgstr "Módulo base para declaraciones AEAT" + +#. module: l10n_es_aeat_mod303_special_prorate_regularization +#: model:ir.model.fields,field_description:l10n_es_aeat_mod303_special_prorate_regularization.field_l10n_es_aeat_report__prorate_year_id +msgid "Prorate Year" +msgstr "Año de prorrata" + +#. module: l10n_es_aeat_mod303_special_prorate_regularization +#: code:addons/l10n_es_aeat_mod303_special_prorate_regularization/models/mod303.py:0 +#, python-format +msgid "" +"The year: %(year)s of the model 303 and the year of date start and date end " +"(%(date_start)s, %(date_end)s) must be the same." +msgstr "" +"El año %(year)s del modelo 303 y los años de la fecha de inicio y de la " +"finalización (%(date_start)s, %(date_end)s) deben ser el mismo." diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/models/__init__.py b/l10n_es_aeat_mod303_special_prorate_regularization/models/__init__.py new file mode 100644 index 000000000..a2bf94f60 --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/models/__init__.py @@ -0,0 +1,2 @@ +from . import l10n_es_aeat_report +from . import mod303 diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/models/l10n_es_aeat_report.py b/l10n_es_aeat_mod303_special_prorate_regularization/models/l10n_es_aeat_report.py new file mode 100644 index 000000000..83f078342 --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/models/l10n_es_aeat_report.py @@ -0,0 +1,49 @@ +# Copyright NuoBiT Solutions SL - Kilian Niubo +# Copyright NuoBiT Solutions SL - Eric Antones +# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import api, fields, models + + +class L10nEsAeatReport(models.AbstractModel): + _inherit = "l10n.es.aeat.report" + + prorate_year_id = fields.Many2one( + comodel_name="aeat.map.special.prorrate.year", + compute="_compute_prorate_year_id", + ) + + @api.depends("company_id", "year") + def _compute_prorate_year_id(self): + for rec in self: + rec.prorate_year_id = self.env[ + "aeat.map.special.prorrate.year" + ].get_by_ukey(rec.company_id.id, rec.year) + + def _prepare_capital_asset_moves(self): + return [] + + def _prepare_prorate_moves(self): + return [] + + def button_unpost(self): + """Remove created account move entry and set state to cancelled.""" + res = super().button_unpost() + move_ids = self._prepare_prorate_moves() + self._prepare_capital_asset_moves() + if not move_ids: + return res + self.env["account.move"].browse(move_ids).with_context( + force_delete=True + ).unlink() + return res + + def button_open_move(self): + action = super().button_open_move() + move_ids = self._prepare_prorate_moves() + self._prepare_capital_asset_moves() + if not move_ids: + return action + action["domain"] = [("id", "in", [action["res_id"]] + move_ids)] + action["view_mode"] = "list,form" + del action["res_id"] + return action diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/models/mod303.py b/l10n_es_aeat_mod303_special_prorate_regularization/models/mod303.py new file mode 100644 index 000000000..3e5784ce1 --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/models/mod303.py @@ -0,0 +1,43 @@ +# Copyright NuoBiT Solutions SL - Kilian Niubo +# Copyright NuoBiT Solutions SL - Eric Antones +# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import _, api, models +from odoo.exceptions import ValidationError + + +class L10nEsAeatMod303Report(models.AbstractModel): + _inherit = "l10n.es.aeat.mod303.report" + + def _prepare_tax_line_vals_dates(self, date_start, date_end, map_line): + date_values = { + "date_start": date_start, + "date_end": date_end, + } + res = super( + L10nEsAeatMod303Report, + self.new(self.copy_data(default=date_values)[0]), + )._prepare_tax_line_vals(map_line) + res["res_id"] = self.id + return res + + @api.constrains("year", "date_start", "date_end") + def _check_mod_303_year(self): + for rec in self: + if rec.date_start.year != rec.year or rec.date_end.year != rec.year: + raise ValidationError( + _( + "The year: %(year)s of the model 303 and the year of " + "date start and date end (%(date_start)s, %(date_end)s) " + "must be the same.", + year=rec.year, + date_start=rec.date_start.year, + date_end=rec.date_end.year, + ) + ) + + def _eligible_prorate_period(self): + return ( + self.period_type in ("4T", "12") and self.company_id.l10n_es_prorate_enabled + ) diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/pyproject.toml b/l10n_es_aeat_mod303_special_prorate_regularization/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/readme/CONTRIBUTORS.md b/l10n_es_aeat_mod303_special_prorate_regularization/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..0355cecbc --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- [NuoBiT](https://www.nuobit.com): + - Kilian Niubo + - Eric Antones + - Deniz Gallo diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/readme/DESCRIPTION.md b/l10n_es_aeat_mod303_special_prorate_regularization/readme/DESCRIPTION.md new file mode 100644 index 000000000..b2b296582 --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module adds hooks and common methods for regularizations diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/static/description/icon.png b/l10n_es_aeat_mod303_special_prorate_regularization/static/description/icon.png new file mode 100644 index 000000000..1cd641e79 Binary files /dev/null and b/l10n_es_aeat_mod303_special_prorate_regularization/static/description/icon.png differ diff --git a/l10n_es_aeat_mod303_special_prorate_regularization/static/description/index.html b/l10n_es_aeat_mod303_special_prorate_regularization/static/description/index.html new file mode 100644 index 000000000..fa8c05ce2 --- /dev/null +++ b/l10n_es_aeat_mod303_special_prorate_regularization/static/description/index.html @@ -0,0 +1,421 @@ + + + + + +AEAT 303 - Special Prorate Regularization + + + +
+

AEAT 303 - Special Prorate Regularization

+ + +

Beta License: AGPL-3 NuoBiT/odoo-addons

+

This module adds hooks and common methods for regularizations

+

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

+
    +
  • NuoBiT Solutions SL
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the NuoBiT/odoo-addons project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..3c24b6227 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +odoo-addon-l10n_es_special_prorate@git+https://github.com/nuobit/odoo-addons.git@refs/pull/800/head#subdirectory=l10n_es_special_prorate +odoo-addon-l10n_es_aeat_vat_special_prorrate@git+https://github.com/nuobit/odoo-addons.git@refs/pull/835/head#subdirectory=l10n_es_aeat_vat_special_prorrate