Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
64 changes: 64 additions & 0 deletions l10n_es_aeat_mod303_special_prorate_regularization/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/NuoBiT/odoo-addons/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 <https://github.com/NuoBiT/odoo-addons/issues/new?body=module:%20l10n_es_aeat_mod303_special_prorate_regularization%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* NuoBiT Solutions SL

Contributors
------------

- `NuoBiT <https://www.nuobit.com>`__:

- Kilian Niubo [email protected]
- Eric Antones [email protected]
- Deniz Gallo [email protected]

Maintainers
-----------

This module is part of the `NuoBiT/odoo-addons <https://github.com/NuoBiT/odoo-addons/tree/18.0/l10n_es_aeat_mod303_special_prorate_regularization>`_ project on GitHub.

You are welcome to contribute.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions l10n_es_aeat_mod303_special_prorate_regularization/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright NuoBiT Solutions SL - Kilian Niubo <[email protected]>
# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo <[email protected]>
# 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",
],
}
41 changes: 41 additions & 0 deletions l10n_es_aeat_mod303_special_prorate_regularization/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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."
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import l10n_es_aeat_report
from . import mod303
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright NuoBiT Solutions SL - Kilian Niubo <[email protected]>
# Copyright NuoBiT Solutions SL - Eric Antones <[email protected]>
# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo <[email protected]>
# 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright NuoBiT Solutions SL - Kilian Niubo <[email protected]>
# Copyright NuoBiT Solutions SL - Eric Antones <[email protected]>
# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo <[email protected]>
# 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
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [NuoBiT](https://www.nuobit.com):
- Kilian Niubo <[email protected]>
- Eric Antones <[email protected]>
- Deniz Gallo <[email protected]>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds hooks and common methods for regularizations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading