From baa3310b81a822295a007d99b0791298d253d612 Mon Sep 17 00:00:00 2001 From: KNVx Date: Tue, 27 Sep 2022 09:45:56 +0200 Subject: [PATCH 1/6] [ADD] l10n_es_aeat_prorate_asset: New Module --- l10n_es_aeat_prorate_asset/README.rst | 27 +++ l10n_es_aeat_prorate_asset/__init__.py | 1 + l10n_es_aeat_prorate_asset/__manifest__.py | 18 ++ l10n_es_aeat_prorate_asset/i18n/es.po | 88 +++++++++ l10n_es_aeat_prorate_asset/models/__init__.py | 1 + .../models/account_asset.py | 174 ++++++++++++++++++ .../static/description/icon.png | Bin 0 -> 6342 bytes .../views/account_asset.xml | 58 ++++++ 8 files changed, 367 insertions(+) create mode 100644 l10n_es_aeat_prorate_asset/README.rst create mode 100644 l10n_es_aeat_prorate_asset/__init__.py create mode 100644 l10n_es_aeat_prorate_asset/__manifest__.py create mode 100644 l10n_es_aeat_prorate_asset/i18n/es.po create mode 100644 l10n_es_aeat_prorate_asset/models/__init__.py create mode 100644 l10n_es_aeat_prorate_asset/models/account_asset.py create mode 100644 l10n_es_aeat_prorate_asset/static/description/icon.png create mode 100644 l10n_es_aeat_prorate_asset/views/account_asset.xml diff --git a/l10n_es_aeat_prorate_asset/README.rst b/l10n_es_aeat_prorate_asset/README.rst new file mode 100644 index 000000000..5e0ac2ed0 --- /dev/null +++ b/l10n_es_aeat_prorate_asset/README.rst @@ -0,0 +1,27 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +============= +Prorate Asset +============= + +* This module add prorate fields on assets. + +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 smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Kilian Niubo +* Eric Antones + diff --git a/l10n_es_aeat_prorate_asset/__init__.py b/l10n_es_aeat_prorate_asset/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/l10n_es_aeat_prorate_asset/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/l10n_es_aeat_prorate_asset/__manifest__.py b/l10n_es_aeat_prorate_asset/__manifest__.py new file mode 100644 index 000000000..c5df056bb --- /dev/null +++ b/l10n_es_aeat_prorate_asset/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright NuoBiT - Kilian Niubo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "Prorate Asset", + "summary": "This module add prorate fields on asset", + "version": "14.0.1.0.0", + "category": "Accounting", + "author": "NuoBiT Solutions, S.L.", + "website": "https://github.com/nuobit/odoo-addons", + "license": "AGPL-3", + "depends": [ + "account_asset_management_extension", + "l10n_es_aeat_vat_special_prorrate", + "l10n_es_asset_extension", + ], + "data": ["views/account_asset.xml"], +} diff --git a/l10n_es_aeat_prorate_asset/i18n/es.po b/l10n_es_aeat_prorate_asset/i18n/es.po new file mode 100644 index 000000000..cd3f33c59 --- /dev/null +++ b/l10n_es_aeat_prorate_asset/i18n/es.po @@ -0,0 +1,88 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_aeat_prorate_asset +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-09-29 12:06+0000\n" +"PO-Revision-Date: 2022-09-29 12:06+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_prorate_asset +#: model:ir.model,name:l10n_es_aeat_prorate_asset.model_account_asset +msgid "Asset" +msgstr "Activo" + +#. module: l10n_es_aeat_prorate_asset +#: code:addons/l10n_es_aeat_prorate_asset/models/account_asset.py:0 +#, python-format +msgid "Asset has more than 1 Prorate tax. Please, review the invoice %s" +msgstr "El activo tiene mas de un impuesto de prorata. Por favor, revise los impuestos" + +#. module: l10n_es_aeat_prorate_asset +#: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_asset__display_name +#: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_move__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: l10n_es_aeat_prorate_asset +#: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_asset__final_deductible_tax_amount +msgid "Final Deductible VAT Amount" +msgstr "Cuota IVA deducible definitiva" + +#. module: l10n_es_aeat_prorate_asset +#: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_asset__final_non_deductible_tax_amount +msgid "Final Non-Deductible VAT Amount" +msgstr "Cuota IVA no deducible definitiva" + +#. module: l10n_es_aeat_prorate_asset +#: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_asset__final_prorate_percent +msgid "Final Prorate (%)" +msgstr "Prorrata definitiva (%)" + +#. module: l10n_es_aeat_prorate_asset +#: code:addons/l10n_es_aeat_prorate_asset/models/account_asset.py:0 +#, python-format +msgid "" +"It's not possible to modify the temporary or final prorate if already exists" +" value in this years. Temp: %s, Final: %s" +msgstr "No es posible modificar la prorrata temporal o definitiva si ya existe " +"prorrata definida para el año de adquisición del activo. Temp: %s, Definitiva %s" + +#. module: l10n_es_aeat_prorate_asset +#: model_terms:ir.ui.view,arch_db:l10n_es_aeat_prorate_asset.account_asset_view_form +msgid "Prorate" +msgstr "Prorrata" + +#. module: l10n_es_aeat_prorate_asset +#: code:addons/l10n_es_aeat_prorate_asset/models/account_move.py:0 +#, python-format +msgid "Prorate not found in company %s in the year %s" +msgstr "Prorrata no encontrada para la compañia %s en el año %s" + +#. module: l10n_es_aeat_prorate_asset +#: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_asset__prorate_tax_id +msgid "Prorate tax" +msgstr "Impuesto de prorata" + +#. module: l10n_es_aeat_prorate_asset +#: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_asset__temp_deductible_tax_amount +msgid "Temporal Deductible VAT Amount" +msgstr "Cuota IVA deducible provisional" + +#. module: l10n_es_aeat_prorate_asset +#: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_asset__temp_non_deductible_tax_amount +msgid "Temporal Non-Deductible VAT Amount" +msgstr "Cuota IVA no deducible provisional" + +#. module: l10n_es_aeat_prorate_asset +#: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_asset__temp_prorate_percent +msgid "Temporary prorate (%)" +msgstr "Prorrata provisional (%)" diff --git a/l10n_es_aeat_prorate_asset/models/__init__.py b/l10n_es_aeat_prorate_asset/models/__init__.py new file mode 100644 index 000000000..02a692c62 --- /dev/null +++ b/l10n_es_aeat_prorate_asset/models/__init__.py @@ -0,0 +1 @@ +from . import account_asset diff --git a/l10n_es_aeat_prorate_asset/models/account_asset.py b/l10n_es_aeat_prorate_asset/models/account_asset.py new file mode 100644 index 000000000..1360bf983 --- /dev/null +++ b/l10n_es_aeat_prorate_asset/models/account_asset.py @@ -0,0 +1,174 @@ +# Copyright NuoBiT - Kilian Niubo +# Copyright NuoBiT - Eric Antones +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + + +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + +from odoo.addons.account_asset_management.models.account_asset import READONLY_STATES + + +class AccountAsset(models.Model): + _inherit = "account.asset" + + map_special_prorate_year_id = fields.Many2one( + comodel_name="aeat.map.special.prorrate.year", + compute="_compute_map_special_prorate_year_id", + ) + + @api.depends("date_start") + def _compute_map_special_prorate_year_id(self): + for rec in self: + if rec.date_start: + rec.map_special_prorate_year_id = rec.env[ + "aeat.map.special.prorrate.year" + ].get_by_ukey(rec.company_id.id, rec.date_start.year) + else: + rec.map_special_prorate_year_id = False + + def _compute_prorate_amounts(self, percent, is_deductible=True): + self.ensure_one() + ratio = percent / 100 + if not is_deductible: + ratio = 1 - ratio + return self.vat_tax_amount * ratio + + temp_deductible_tax_amount = fields.Float( + string="Temporal Deductible VAT Amount", + compute="_compute_temp_deductible_tax_amount", + store=True, + ) + + @api.depends("prorate_tax_id", "tax_base_amount", "temp_prorate_percent") + def _compute_temp_deductible_tax_amount(self): + for rec in self: + if rec.map_special_prorate_year_id: + rec.temp_deductible_tax_amount = rec._compute_prorate_amounts( + rec.map_special_prorate_year_id.tax_percentage + ) + + temp_non_deductible_tax_amount = fields.Float( + string="Temporal Non-Deductible VAT Amount", + compute="_compute_temp_non_deductible_tax_amount", + store=True, + ) + + @api.depends("prorate_tax_id", "tax_base_amount", "temp_prorate_percent") + def _compute_temp_non_deductible_tax_amount(self): + for rec in self: + if rec.map_special_prorate_year_id: + rec.temp_non_deductible_tax_amount = rec._compute_prorate_amounts( + rec.map_special_prorate_year_id.tax_percentage, is_deductible=False + ) + + final_deductible_tax_amount = fields.Float( + string="Final Deductible VAT Amount", + compute="_compute_final_deductible_tax_amount", + store=True, + ) + + @api.depends("prorate_tax_id", "tax_base_amount", "final_prorate_percent") + def _compute_final_deductible_tax_amount(self): + for rec in self: + if rec.map_special_prorate_year_id: + rec.final_deductible_tax_amount = rec._compute_prorate_amounts( + rec.map_special_prorate_year_id.tax_final_percentage + ) + + final_non_deductible_tax_amount = fields.Float( + string="Final Non-Deductible VAT Amount", + compute="_compute_final_non_deductible_tax_amount", + store=True, + ) + + @api.depends("prorate_tax_id", "tax_base_amount", "final_prorate_percent") + def _compute_final_non_deductible_tax_amount(self): + for rec in self: + if rec.map_special_prorate_year_id: + rec.final_non_deductible_tax_amount = rec._compute_prorate_amounts( + rec.map_special_prorate_year_id.tax_final_percentage, + is_deductible=False, + ) + + temp_prorate_percent = fields.Float( + string="Temporary prorate (%)", + compute="_compute_temp_prorate_percent", + store=True, + readonly=False, + states=READONLY_STATES, + ) + + @api.depends("map_special_prorate_year_id.tax_percentage") + def _compute_temp_prorate_percent(self): + for rec in self: + if rec.map_special_prorate_year_id: + if ( + rec.temp_prorate_percent + != rec.map_special_prorate_year_id.tax_percentage + ): + rec.temp_prorate_percent = ( + rec.map_special_prorate_year_id.tax_percentage + ) + + final_prorate_percent = fields.Float( + string="Final Prorate (%)", + compute="_compute_final_prorate_percent", + store=True, + readonly=False, + states=READONLY_STATES, + ) + + @api.depends("map_special_prorate_year_id.tax_final_percentage") + def _compute_final_prorate_percent(self): + for rec in self: + if rec.map_special_prorate_year_id: + if ( + rec.final_prorate_percent + != rec.map_special_prorate_year_id.tax_final_percentage + ): + rec.final_prorate_percent = ( + rec.map_special_prorate_year_id.tax_final_percentage + ) + + prorate_tax_id = fields.Many2one( + string="Prorate Tax", + comodel_name="account.tax", + compute="_compute_prorate_tax_id", + store=True, + ) + + @api.depends("vat_tax_id", "vat_tax_id.prorate") + def _compute_prorate_tax_id(self): + for rec in self: + taxes = rec.vat_tax_id.filtered(lambda x: x.prorate) + if len(taxes) > 1: + raise ValidationError( + _("Asset has more than 1 Prorate tax. Please, review the taxes") + ) + rec.prorate_tax_id = taxes._origin + + @api.constrains( + "temp_prorate_percent", + "final_prorate_percent", + ) + def _check_move_line(self): + for rec in self: + if rec.date_start: + percentage_line = rec.env["aeat.map.special.prorrate.year"].get_by_ukey( + rec.company_id.id, rec.date_start.year + ) + if percentage_line and ( + percentage_line.tax_final_percentage != rec.final_prorate_percent + or percentage_line.tax_percentage != rec.temp_prorate_percent + ): + raise ValidationError( + _( + "It's not possible to modify the temporary or final prorate " + "if already exists value in this years. Temp: %s, Final: %s" + % ( + percentage_line.tax_percentage, + percentage_line.tax_final_percentage, + ) + ) + ) diff --git a/l10n_es_aeat_prorate_asset/static/description/icon.png b/l10n_es_aeat_prorate_asset/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1cd641e792c30455187ca30940bc0f329ce8bbb0 GIT binary patch literal 6342 zcmd^^hf`C}*TzHWpfm-MZa|7OjYtjE(4`3pP0Eid3J8V{0s)mKJ<q zp^9|rp$mb~2}po9-@oIXJG(oxcjoS%d!O@s&d!Z9HP*e##KQyt0IurmK_64bp8pyH z9i^|ds>-JfbWVo4P{8GX*QeIfb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AwgtkWKn1} z8^>3&)Q05VbBm+t`9B_${w9F7WfM{Jvawk;HDc*{Sa_Sla|zqX!vbKV%>gB|z6BCc z8_bdnPnzloGP1I)!^5hnC6CLZUU`;nO2NF2)FaAkYhQL$Z58+`p75dj7RKse#Z!uacCm z0@|m~U!QZOdb|V~`ktFK4;lg_ZOCjFXeV4`jGj&bh7Q6BEyN8~yGd*JyzwFbIRaAf z#KG$rvQxWFvqwn`i6jBQ?6o+k+oOC)Gj9ChlgabiScr};b5|opxUYjCZOwmhjTj6W zFzJt_htTuopW4IRiQ}r0L}`w=pE{HN<@(9Hl11P5cHmN6A1F^sg2OWXcw<+q2x>I5 zq9Bu>PBob6#^vrr<|IC)m+zJpFRRcCVsqbspNybriu&!R=H^@RcG#aBGz9RH}ZI=>4 zi(m?IA?Vr$Q7?wN6ZW7H`S?3}K8=$7J5MjWKri=_igw1%J?0~*6e_Ii*1&23dGcF} z&=vaMgF!^veGQ1f$3k?WK5Jaw%==+Bb!tI6zQ68&-dQ3Orl+Tqh#Nt?dBEV_w^wkjY+qJ+X*NCMs%J-Lc4%}pKryM#O)O&9 un*HHVB-AlUN`suyDkKONktc!@Ievk;6wT20MOSqhE{1gM*SZGeqiYU literal 0 HcmV?d00001 diff --git a/l10n_es_aeat_prorate_asset/views/account_asset.xml b/l10n_es_aeat_prorate_asset/views/account_asset.xml new file mode 100644 index 000000000..dec7c80c2 --- /dev/null +++ b/l10n_es_aeat_prorate_asset/views/account_asset.xml @@ -0,0 +1,58 @@ + + + + + account.asset + + + + + + + + + + + + + + + + + + + + + + + + + From c2664df2493800afda92d29932f68de93d0e1028 Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Sat, 28 Oct 2023 01:15:21 +0200 Subject: [PATCH 2/6] [REF] l10n_es_aeat_prorate_asset: Update copier template --- l10n_es_aeat_prorate_asset/i18n/es.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_es_aeat_prorate_asset/i18n/es.po b/l10n_es_aeat_prorate_asset/i18n/es.po index cd3f33c59..d5e5cf312 100644 --- a/l10n_es_aeat_prorate_asset/i18n/es.po +++ b/l10n_es_aeat_prorate_asset/i18n/es.po @@ -23,8 +23,8 @@ msgstr "Activo" #. module: l10n_es_aeat_prorate_asset #: code:addons/l10n_es_aeat_prorate_asset/models/account_asset.py:0 #, python-format -msgid "Asset has more than 1 Prorate tax. Please, review the invoice %s" -msgstr "El activo tiene mas de un impuesto de prorata. Por favor, revise los impuestos" +msgid "Asset has more than 1 Prorate tax. Please, review the invoice" +msgstr "El activo tiene mas de un impuesto de prorata. Por favor, revise la factura" #. module: l10n_es_aeat_prorate_asset #: model:ir.model.fields,field_description:l10n_es_aeat_prorate_asset.field_account_asset__display_name From e92a530644ba47b3857cb5cc9aa7571a00d4ff64 Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Thu, 8 Jan 2026 22:43:31 +0100 Subject: [PATCH 3/6] [FIX] l10n_es_aeat_prorate_asset: error creating new year prorate --- l10n_es_aeat_prorate_asset/models/account_asset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_es_aeat_prorate_asset/models/account_asset.py b/l10n_es_aeat_prorate_asset/models/account_asset.py index 1360bf983..9b2b2de13 100644 --- a/l10n_es_aeat_prorate_asset/models/account_asset.py +++ b/l10n_es_aeat_prorate_asset/models/account_asset.py @@ -152,9 +152,9 @@ def _compute_prorate_tax_id(self): "temp_prorate_percent", "final_prorate_percent", ) - def _check_move_line(self): + def _check_prorate_percent(self): for rec in self: - if rec.date_start: + if rec.prorate_tax_id and rec.date_start: percentage_line = rec.env["aeat.map.special.prorrate.year"].get_by_ukey( rec.company_id.id, rec.date_start.year ) From e48426cb594f11b8e275ce5309032d8a0d3307e2 Mon Sep 17 00:00:00 2001 From: ??? Date: Tue, 10 Feb 2026 17:31:31 +0100 Subject: [PATCH 4/6] [IMP] l10n_es_aeat_prorate_asset: pre-commit auto fixes --- l10n_es_aeat_prorate_asset/__manifest__.py | 2 +- l10n_es_aeat_prorate_asset/pyproject.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 l10n_es_aeat_prorate_asset/pyproject.toml diff --git a/l10n_es_aeat_prorate_asset/__manifest__.py b/l10n_es_aeat_prorate_asset/__manifest__.py index c5df056bb..89847a367 100644 --- a/l10n_es_aeat_prorate_asset/__manifest__.py +++ b/l10n_es_aeat_prorate_asset/__manifest__.py @@ -7,7 +7,7 @@ "version": "14.0.1.0.0", "category": "Accounting", "author": "NuoBiT Solutions, S.L.", - "website": "https://github.com/nuobit/odoo-addons", + "website": "https://github.com/NuoBiT/odoo-addons", "license": "AGPL-3", "depends": [ "account_asset_management_extension", diff --git a/l10n_es_aeat_prorate_asset/pyproject.toml b/l10n_es_aeat_prorate_asset/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/l10n_es_aeat_prorate_asset/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" From 31bab96b2a28b59c3be713b35a893d2bd23170f2 Mon Sep 17 00:00:00 2001 From: ??? Date: Tue, 10 Feb 2026 17:48:40 +0100 Subject: [PATCH 5/6] [MIG] l10n_es_aeat_prorate_asset: Migration to 18.0 --- l10n_es_aeat_prorate_asset/README.rst | 59 ++- l10n_es_aeat_prorate_asset/__manifest__.py | 7 +- .../models/account_asset.py | 24 +- .../readme/CONTRIBUTORS.md | 4 + .../readme/DESCRIPTION.md | 0 .../static/description/index.html | 420 ++++++++++++++++++ .../views/account_asset.xml | 14 +- 7 files changed, 498 insertions(+), 30 deletions(-) create mode 100644 l10n_es_aeat_prorate_asset/readme/CONTRIBUTORS.md create mode 100644 l10n_es_aeat_prorate_asset/readme/DESCRIPTION.md create mode 100644 l10n_es_aeat_prorate_asset/static/description/index.html diff --git a/l10n_es_aeat_prorate_asset/README.rst b/l10n_es_aeat_prorate_asset/README.rst index 5e0ac2ed0..28ec957f5 100644 --- a/l10n_es_aeat_prorate_asset/README.rst +++ b/l10n_es_aeat_prorate_asset/README.rst @@ -1,27 +1,64 @@ -.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png - :target: https://www.gnu.org/licenses/agpl - :alt: License: AGPL-3 - ============= Prorate Asset ============= -* This module add prorate fields on assets. +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5c25a72d8e2dc152891aedd340e057909faddbde004d6ef957e252c1ea5cf730 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_prorate_asset + :alt: NuoBiT/odoo-addons + +|badge1| |badge2| |badge3| + + + +**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 smashing it by providing a detailed and welcomed feedback. +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 ------------ -* Kilian Niubo -* Eric Antones +- `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_prorate_asset/__manifest__.py b/l10n_es_aeat_prorate_asset/__manifest__.py index 89847a367..a81245c4d 100644 --- a/l10n_es_aeat_prorate_asset/__manifest__.py +++ b/l10n_es_aeat_prorate_asset/__manifest__.py @@ -1,12 +1,13 @@ -# Copyright NuoBiT - Kilian Niubo +# 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": "Prorate Asset", "summary": "This module add prorate fields on asset", - "version": "14.0.1.0.0", + "version": "18.0.1.0.0", "category": "Accounting", - "author": "NuoBiT Solutions, S.L.", + "author": "NuoBiT Solutions SL", "website": "https://github.com/NuoBiT/odoo-addons", "license": "AGPL-3", "depends": [ diff --git a/l10n_es_aeat_prorate_asset/models/account_asset.py b/l10n_es_aeat_prorate_asset/models/account_asset.py index 9b2b2de13..e122a7182 100644 --- a/l10n_es_aeat_prorate_asset/models/account_asset.py +++ b/l10n_es_aeat_prorate_asset/models/account_asset.py @@ -1,13 +1,11 @@ -# Copyright NuoBiT - Kilian Niubo -# Copyright NuoBiT - Eric Antones +# Copyright NuoBiT Solutions SL - Kilian Niubo +# Copyright NuoBiT Solutions SL - Eric Antones # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) from odoo import _, api, fields, models from odoo.exceptions import ValidationError -from odoo.addons.account_asset_management.models.account_asset import READONLY_STATES - class AccountAsset(models.Model): _inherit = "account.asset" @@ -15,6 +13,7 @@ class AccountAsset(models.Model): map_special_prorate_year_id = fields.Many2one( comodel_name="aeat.map.special.prorrate.year", compute="_compute_map_special_prorate_year_id", + store=True, ) @api.depends("date_start") @@ -96,7 +95,6 @@ def _compute_final_non_deductible_tax_amount(self): compute="_compute_temp_prorate_percent", store=True, readonly=False, - states=READONLY_STATES, ) @api.depends("map_special_prorate_year_id.tax_percentage") @@ -116,7 +114,6 @@ def _compute_temp_prorate_percent(self): compute="_compute_final_prorate_percent", store=True, readonly=False, - states=READONLY_STATES, ) @api.depends("map_special_prorate_year_id.tax_final_percentage") @@ -164,11 +161,14 @@ def _check_prorate_percent(self): ): raise ValidationError( _( - "It's not possible to modify the temporary or final prorate " - "if already exists value in this years. Temp: %s, Final: %s" - % ( - percentage_line.tax_percentage, - percentage_line.tax_final_percentage, - ) + "It's not possible to modify the temporary or" + " final prorate if already exists value in " + "this years. " + "Temp: %(tax_percentage)s " + "Final: %(tax_final)s" ) + % { + "tax_percentage": percentage_line.tax_percentage, + "tax_final": percentage_line.tax_final_percentage, + } ) diff --git a/l10n_es_aeat_prorate_asset/readme/CONTRIBUTORS.md b/l10n_es_aeat_prorate_asset/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..0355cecbc --- /dev/null +++ b/l10n_es_aeat_prorate_asset/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- [NuoBiT](https://www.nuobit.com): + - Kilian Niubo + - Eric Antones + - Deniz Gallo diff --git a/l10n_es_aeat_prorate_asset/readme/DESCRIPTION.md b/l10n_es_aeat_prorate_asset/readme/DESCRIPTION.md new file mode 100644 index 000000000..e69de29bb diff --git a/l10n_es_aeat_prorate_asset/static/description/index.html b/l10n_es_aeat_prorate_asset/static/description/index.html new file mode 100644 index 000000000..1e4fc7986 --- /dev/null +++ b/l10n_es_aeat_prorate_asset/static/description/index.html @@ -0,0 +1,420 @@ + + + + + +Prorate Asset + + + +
+

Prorate Asset

+ + +

Beta License: AGPL-3 NuoBiT/odoo-addons

+

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/l10n_es_aeat_prorate_asset/views/account_asset.xml b/l10n_es_aeat_prorate_asset/views/account_asset.xml index dec7c80c2..f9e906392 100644 --- a/l10n_es_aeat_prorate_asset/views/account_asset.xml +++ b/l10n_es_aeat_prorate_asset/views/account_asset.xml @@ -1,5 +1,5 @@ - @@ -13,7 +13,7 @@ @@ -25,7 +25,10 @@ - + - + Date: Tue, 3 Mar 2026 12:21:22 +0100 Subject: [PATCH 6/6] [DO NOT MERGE] test-requirements.txt --- test-requirements.txt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test-requirements.txt diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..4e6969f45 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,5 @@ +odoo-addon-l10n_es_extension@git+https://github.com/nuobit/odoo-addons.git@refs/pull/769/head#subdirectory=l10n_es_extension +odoo-addon-account_asset_management_extension@git+https://github.com/nuobit/odoo-addons.git@refs/pull/754/head#subdirectory=account_asset_management_extension +odoo-addon-l10n_es_asset_extension@git+https://github.com/nuobit/odoo-addons.git@refs/pull/780/head#subdirectory=l10n_es_asset_extension +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