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_prorate_asset/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
=============
Prorate Asset
=============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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 <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_prorate_asset%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_prorate_asset>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions l10n_es_aeat_prorate_asset/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions l10n_es_aeat_prorate_asset/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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": "Prorate Asset",
"summary": "This module add prorate fields on asset",
"version": "18.0.1.0.0",
"category": "Accounting",
"author": "NuoBiT Solutions SL",
"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"],
}
88 changes: 88 additions & 0 deletions l10n_es_aeat_prorate_asset/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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"
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
#: 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 (%)"
1 change: 1 addition & 0 deletions l10n_es_aeat_prorate_asset/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_asset
174 changes: 174 additions & 0 deletions l10n_es_aeat_prorate_asset/models/account_asset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Copyright NuoBiT Solutions SL - Kilian Niubo <[email protected]>
# Copyright NuoBiT Solutions SL - Eric Antones <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)


from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


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",
store=True,
)

@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,
)

@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,
)

@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_prorate_percent(self):
for rec in self:
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
)
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: %(tax_percentage)s "
"Final: %(tax_final)s"
)
% {
"tax_percentage": percentage_line.tax_percentage,
"tax_final": percentage_line.tax_final_percentage,
}
)
3 changes: 3 additions & 0 deletions l10n_es_aeat_prorate_asset/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions l10n_es_aeat_prorate_asset/readme/CONTRIBUTORS.md
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]>
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading