From 24126c3ba7c93e4aa04de339bb48b45c4e192d5b Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Fri, 27 Dec 2019 17:33:30 +0100 Subject: [PATCH 01/12] [ADD] account_asset_non_deductible: new module to add non-deductible tax amount to asset value --- account_asset_non_deductible/README.rst | 30 ++++++++++++ account_asset_non_deductible/__init__.py | 5 ++ account_asset_non_deductible/__manifest__.py | 20 ++++++++ .../models/__init__.py | 5 ++ .../models/account_invoice.py | 44 ++++++++++++++++++ .../static/description/icon.png | Bin 0 -> 6342 bytes .../views/account_analytic_contract_view.xml | 17 +++++++ 7 files changed, 121 insertions(+) create mode 100644 account_asset_non_deductible/README.rst create mode 100644 account_asset_non_deductible/__init__.py create mode 100644 account_asset_non_deductible/__manifest__.py create mode 100644 account_asset_non_deductible/models/__init__.py create mode 100644 account_asset_non_deductible/models/account_invoice.py create mode 100644 account_asset_non_deductible/static/description/icon.png create mode 100644 account_asset_non_deductible/views/account_analytic_contract_view.xml diff --git a/account_asset_non_deductible/README.rst b/account_asset_non_deductible/README.rst new file mode 100644 index 000000000..13e93ccd5 --- /dev/null +++ b/account_asset_non_deductible/README.rst @@ -0,0 +1,30 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +========================== +Non-deductible asset value +========================== + +* This module adds a non-deductible tax amount to the asset value + + +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 +------------ + +* Eric Antones + + + + diff --git a/account_asset_non_deductible/__init__.py b/account_asset_non_deductible/__init__.py new file mode 100644 index 000000000..38b2ba65b --- /dev/null +++ b/account_asset_non_deductible/__init__.py @@ -0,0 +1,5 @@ +# Copyright NuoBiT Solutions, S.L. () +# Eric Antones +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from . import models diff --git a/account_asset_non_deductible/__manifest__.py b/account_asset_non_deductible/__manifest__.py new file mode 100644 index 000000000..a29e57fe7 --- /dev/null +++ b/account_asset_non_deductible/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright NuoBiT Solutions, S.L. () +# Eric Antones +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + 'name': 'Non-deductible asset value', + 'summary': 'Adds a non-deductible tax amount to the asset value', + 'version': '11.0.1.0.0', + 'category': 'Accounting', + 'author': 'NuoBiT Solutions, S.L., Eric Antones', + 'website': 'https://github.com/nuobit', + 'license': 'AGPL-3', + 'depends': [ + 'l10n_es_account_asset', + 'l10n_es_aeat_vat_special_prorrate', + ], + 'installable': True, + 'development_status': 'Beta', + 'maintainers': ['eantones'], +} diff --git a/account_asset_non_deductible/models/__init__.py b/account_asset_non_deductible/models/__init__.py new file mode 100644 index 000000000..7467cbd01 --- /dev/null +++ b/account_asset_non_deductible/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright NuoBiT Solutions, S.L. () +# Eric Antones +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from . import account_invoice diff --git a/account_asset_non_deductible/models/account_invoice.py b/account_asset_non_deductible/models/account_invoice.py new file mode 100644 index 000000000..746b9969f --- /dev/null +++ b/account_asset_non_deductible/models/account_invoice.py @@ -0,0 +1,44 @@ +# Copyright NuoBiT Solutions, S.L. () +# Eric Antones +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from datetime import datetime +from dateutil.relativedelta import relativedelta +from odoo import api, models +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF + + +class AccountInvoiceLine(models.Model): + _inherit = 'account.invoice.line' + + @api.one + def asset_create(self): + if self.asset_category_id: + value = self.price_subtotal_signed + + tax_non_deductible_percent = \ + self.invoice_line_tax_ids._get_non_deductible_percent( + self.invoice_id.date or self.invoice_id.date_invoice, + self.invoice_id.company_id or self.env.user.company_id + ) + if tax_non_deductible_percent: + value += round(value * tax_non_deductible_percent / 100, + self.currency_id.decimal_places) + + vals = { + 'name': self.name, + 'code': self.invoice_id.number or False, + 'category_id': self.asset_category_id.id, + 'value': value, + 'partner_id': self.invoice_id.partner_id.id, + 'company_id': self.invoice_id.company_id.id, + 'currency_id': self.invoice_id.company_currency_id.id, + 'date': self.invoice_id.date_invoice, + 'invoice_id': self.invoice_id.id, + } + changed_vals = self.env['account.asset.asset'].onchange_category_id_values(vals['category_id']) + vals.update(changed_vals['value']) + asset = self.env['account.asset.asset'].create(vals) + if self.asset_category_id.open_asset: + asset.validate() + return True diff --git a/account_asset_non_deductible/static/description/icon.png b/account_asset_non_deductible/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*QeIfbjl2)kDfIG0ALvZuTgp2ZfK=U();NfY11z-vM>r= zo6RyI007+P`cO@apy}VqnaiVCLL`CEUGVGYE&5WpdhhbZv%|*-Y|2t(4~Cq|y`-Nmm-W zxaTf4+R69rVU1b%qjm?yu*PFgHFYd#J82-D8cpXqO&omwG2*Hd6ZIUiK@+ zNCo8Lg{1^vn^0ZQgz*~*ZR3wsULxnnSBN%7p()3EYs>sX9In)T{*nJ2q*qxXPNhFk z=z=+?4VOOdAF!ZYAVisYzF29g?udLQJtx@=HoAK_Kjx;4SO7>H_v*McB7(}RHMa> z+PNao{Hw&Mjo0P}CBR&l(k@iIeRI@PRH6R9^lR3e?TL?ZHra#GHvKmkeVBHG8nv4{ zz$nHGR7`D$ae@TrcXCSA=$~Yvp@J|bKul>6s-`yT7>JaM5?KcltZ)(ilt^74fqLA{ z1k!bKw(GMV*AOgI*glG_($h!cZgArkEAa1SkSG`0yF8JLWTq^J->2CRaqK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GQ1f$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/account_asset_non_deductible/views/account_analytic_contract_view.xml b/account_asset_non_deductible/views/account_analytic_contract_view.xml new file mode 100644 index 000000000..bbfab7cb1 --- /dev/null +++ b/account_asset_non_deductible/views/account_analytic_contract_view.xml @@ -0,0 +1,17 @@ + + + + + + account.analytic.account + + + + + + + + + From d9b89fcffb8ef3f1e8c64acd0e00f5fe6c06122a Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Tue, 22 Dec 2020 15:12:48 +0100 Subject: [PATCH 02/12] [IMP] account_asset_non_deductible: make it compatible with account_asset_product_item --- account_asset_non_deductible/__manifest__.py | 4 +- .../models/account_invoice.py | 48 +++++-------------- .../views/account_analytic_contract_view.xml | 17 ------- 3 files changed, 15 insertions(+), 54 deletions(-) delete mode 100644 account_asset_non_deductible/views/account_analytic_contract_view.xml diff --git a/account_asset_non_deductible/__manifest__.py b/account_asset_non_deductible/__manifest__.py index a29e57fe7..6b2336a06 100644 --- a/account_asset_non_deductible/__manifest__.py +++ b/account_asset_non_deductible/__manifest__.py @@ -5,13 +5,13 @@ { 'name': 'Non-deductible asset value', 'summary': 'Adds a non-deductible tax amount to the asset value', - 'version': '11.0.1.0.0', + 'version': '11.0.1.2.0', 'category': 'Accounting', 'author': 'NuoBiT Solutions, S.L., Eric Antones', 'website': 'https://github.com/nuobit', 'license': 'AGPL-3', 'depends': [ - 'l10n_es_account_asset', + 'account_asset_product_item', 'l10n_es_aeat_vat_special_prorrate', ], 'installable': True, diff --git a/account_asset_non_deductible/models/account_invoice.py b/account_asset_non_deductible/models/account_invoice.py index 746b9969f..40d818c6a 100644 --- a/account_asset_non_deductible/models/account_invoice.py +++ b/account_asset_non_deductible/models/account_invoice.py @@ -2,43 +2,21 @@ # Eric Antones # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -from datetime import datetime -from dateutil.relativedelta import relativedelta -from odoo import api, models -from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF +from odoo import models class AccountInvoiceLine(models.Model): _inherit = 'account.invoice.line' - @api.one - def asset_create(self): - if self.asset_category_id: - value = self.price_subtotal_signed - - tax_non_deductible_percent = \ - self.invoice_line_tax_ids._get_non_deductible_percent( - self.invoice_id.date or self.invoice_id.date_invoice, - self.invoice_id.company_id or self.env.user.company_id - ) - if tax_non_deductible_percent: - value += round(value * tax_non_deductible_percent / 100, - self.currency_id.decimal_places) - - vals = { - 'name': self.name, - 'code': self.invoice_id.number or False, - 'category_id': self.asset_category_id.id, - 'value': value, - 'partner_id': self.invoice_id.partner_id.id, - 'company_id': self.invoice_id.company_id.id, - 'currency_id': self.invoice_id.company_currency_id.id, - 'date': self.invoice_id.date_invoice, - 'invoice_id': self.invoice_id.id, - } - changed_vals = self.env['account.asset.asset'].onchange_category_id_values(vals['category_id']) - vals.update(changed_vals['value']) - asset = self.env['account.asset.asset'].create(vals) - if self.asset_category_id.open_asset: - asset.validate() - return True + def _get_asset_base_value(self): + super(AccountInvoiceLine, self)._get_asset_base_value() + value = self.price_subtotal_signed + tax_non_deductible_percent = \ + self.invoice_line_tax_ids._get_non_deductible_percent( + self.invoice_id.date or self.invoice_id.date_invoice, + self.invoice_id.company_id or self.env.user.company_id + ) + if tax_non_deductible_percent: + value += round(value * tax_non_deductible_percent / 100, + self.currency_id.decimal_places) + return value diff --git a/account_asset_non_deductible/views/account_analytic_contract_view.xml b/account_asset_non_deductible/views/account_analytic_contract_view.xml deleted file mode 100644 index bbfab7cb1..000000000 --- a/account_asset_non_deductible/views/account_analytic_contract_view.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - account.analytic.account - - - - - - - - - From 2ae346c84161417b7129bebc44a115ca6eed91e5 Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Mon, 28 Dec 2020 18:58:16 +0100 Subject: [PATCH 03/12] [REF+FIX] account_asset_non_deductible: update method arguments to make it compatible with latest changes --- account_asset_non_deductible/__manifest__.py | 2 +- account_asset_non_deductible/models/account_invoice.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/account_asset_non_deductible/__manifest__.py b/account_asset_non_deductible/__manifest__.py index 6b2336a06..2f37c4e70 100644 --- a/account_asset_non_deductible/__manifest__.py +++ b/account_asset_non_deductible/__manifest__.py @@ -5,7 +5,7 @@ { 'name': 'Non-deductible asset value', 'summary': 'Adds a non-deductible tax amount to the asset value', - 'version': '11.0.1.2.0', + 'version': '11.0.1.2.1', 'category': 'Accounting', 'author': 'NuoBiT Solutions, S.L., Eric Antones', 'website': 'https://github.com/nuobit', diff --git a/account_asset_non_deductible/models/account_invoice.py b/account_asset_non_deductible/models/account_invoice.py index 40d818c6a..7a1fd417d 100644 --- a/account_asset_non_deductible/models/account_invoice.py +++ b/account_asset_non_deductible/models/account_invoice.py @@ -12,9 +12,9 @@ def _get_asset_base_value(self): super(AccountInvoiceLine, self)._get_asset_base_value() value = self.price_subtotal_signed tax_non_deductible_percent = \ - self.invoice_line_tax_ids._get_non_deductible_percent( + self.invoice_line_tax_ids.get_non_deductible_percent( self.invoice_id.date or self.invoice_id.date_invoice, - self.invoice_id.company_id or self.env.user.company_id + self.invoice_id.company_id.id or self.env.user.company_id.id ) if tax_non_deductible_percent: value += round(value * tax_non_deductible_percent / 100, From 360f34a3edbf7ba8a13cdf0943ec99e9462f7521 Mon Sep 17 00:00:00 2001 From: Christopher Ormaza Date: Mon, 27 Dec 2021 08:40:12 -0500 Subject: [PATCH 04/12] [IMP] account_asset_non_deductible: black, isort, prettier --- account_asset_non_deductible/__manifest__.py | 26 +++++++++---------- .../models/account_invoice.py | 13 ++++++---- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/account_asset_non_deductible/__manifest__.py b/account_asset_non_deductible/__manifest__.py index 2f37c4e70..4ccc157fc 100644 --- a/account_asset_non_deductible/__manifest__.py +++ b/account_asset_non_deductible/__manifest__.py @@ -3,18 +3,18 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) { - 'name': 'Non-deductible asset value', - 'summary': 'Adds a non-deductible tax amount to the asset value', - 'version': '11.0.1.2.1', - 'category': 'Accounting', - 'author': 'NuoBiT Solutions, S.L., Eric Antones', - 'website': 'https://github.com/nuobit', - 'license': 'AGPL-3', - 'depends': [ - 'account_asset_product_item', - 'l10n_es_aeat_vat_special_prorrate', + "name": "Non-deductible asset value", + "summary": "Adds a non-deductible tax amount to the asset value", + "version": "11.0.1.2.1", + "category": "Accounting", + "author": "NuoBiT Solutions, S.L., Eric Antones", + "website": "https://github.com/nuobit/odoo-addons", + "license": "AGPL-3", + "depends": [ + "account_asset_product_item", + "l10n_es_aeat_vat_special_prorrate", ], - 'installable': True, - 'development_status': 'Beta', - 'maintainers': ['eantones'], + "installable": True, + "development_status": "Beta", + "maintainers": ["eantones"], } diff --git a/account_asset_non_deductible/models/account_invoice.py b/account_asset_non_deductible/models/account_invoice.py index 7a1fd417d..43614a30c 100644 --- a/account_asset_non_deductible/models/account_invoice.py +++ b/account_asset_non_deductible/models/account_invoice.py @@ -6,17 +6,20 @@ class AccountInvoiceLine(models.Model): - _inherit = 'account.invoice.line' + _inherit = "account.invoice.line" def _get_asset_base_value(self): super(AccountInvoiceLine, self)._get_asset_base_value() value = self.price_subtotal_signed - tax_non_deductible_percent = \ + tax_non_deductible_percent = ( self.invoice_line_tax_ids.get_non_deductible_percent( self.invoice_id.date or self.invoice_id.date_invoice, - self.invoice_id.company_id.id or self.env.user.company_id.id + self.invoice_id.company_id.id or self.env.user.company_id.id, ) + ) if tax_non_deductible_percent: - value += round(value * tax_non_deductible_percent / 100, - self.currency_id.decimal_places) + value += round( + value * tax_non_deductible_percent / 100, + self.currency_id.decimal_places, + ) return value From 35cad92fd9695634cd155de3f587c75210206056 Mon Sep 17 00:00:00 2001 From: Christopher Ormaza Date: Mon, 27 Dec 2021 09:35:23 -0500 Subject: [PATCH 05/12] [14.0][MIG] account_asset_non_deductible: Migration to 14.0 --- account_asset_non_deductible/README.rst | 8 +--- account_asset_non_deductible/__manifest__.py | 2 +- .../models/__init__.py | 2 +- .../models/account_invoice.py | 25 ------------- .../models/account_move.py | 37 +++++++++++++++++++ 5 files changed, 41 insertions(+), 33 deletions(-) delete mode 100644 account_asset_non_deductible/models/account_invoice.py create mode 100644 account_asset_non_deductible/models/account_move.py diff --git a/account_asset_non_deductible/README.rst b/account_asset_non_deductible/README.rst index 13e93ccd5..aed6e94e5 100644 --- a/account_asset_non_deductible/README.rst +++ b/account_asset_non_deductible/README.rst @@ -1,5 +1,5 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl :alt: License: AGPL-3 ========================== @@ -24,7 +24,3 @@ Contributors ------------ * Eric Antones - - - - diff --git a/account_asset_non_deductible/__manifest__.py b/account_asset_non_deductible/__manifest__.py index 4ccc157fc..8aaaa5fde 100644 --- a/account_asset_non_deductible/__manifest__.py +++ b/account_asset_non_deductible/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Non-deductible asset value", "summary": "Adds a non-deductible tax amount to the asset value", - "version": "11.0.1.2.1", + "version": "14.0.1.0.0", "category": "Accounting", "author": "NuoBiT Solutions, S.L., Eric Antones", "website": "https://github.com/nuobit/odoo-addons", diff --git a/account_asset_non_deductible/models/__init__.py b/account_asset_non_deductible/models/__init__.py index 7467cbd01..a310781e3 100644 --- a/account_asset_non_deductible/models/__init__.py +++ b/account_asset_non_deductible/models/__init__.py @@ -2,4 +2,4 @@ # Eric Antones # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -from . import account_invoice +from . import account_move diff --git a/account_asset_non_deductible/models/account_invoice.py b/account_asset_non_deductible/models/account_invoice.py deleted file mode 100644 index 43614a30c..000000000 --- a/account_asset_non_deductible/models/account_invoice.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright NuoBiT Solutions, S.L. () -# Eric Antones -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) - -from odoo import models - - -class AccountInvoiceLine(models.Model): - _inherit = "account.invoice.line" - - def _get_asset_base_value(self): - super(AccountInvoiceLine, self)._get_asset_base_value() - value = self.price_subtotal_signed - tax_non_deductible_percent = ( - self.invoice_line_tax_ids.get_non_deductible_percent( - self.invoice_id.date or self.invoice_id.date_invoice, - self.invoice_id.company_id.id or self.env.user.company_id.id, - ) - ) - if tax_non_deductible_percent: - value += round( - value * tax_non_deductible_percent / 100, - self.currency_id.decimal_places, - ) - return value diff --git a/account_asset_non_deductible/models/account_move.py b/account_asset_non_deductible/models/account_move.py new file mode 100644 index 000000000..c28edbe86 --- /dev/null +++ b/account_asset_non_deductible/models/account_move.py @@ -0,0 +1,37 @@ +# Copyright NuoBiT Solutions, S.L. () +# Eric Antones +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import models + + +class AccountMove(models.Model): + _inherit = "account.move" + + def _prepare_asset_vals(self, aml): + vals = super()._prepare_asset_vals(aml) + vals.update( + { + "purchase_value": aml._get_asset_base_value(), + } + ) + return vals + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + def _get_asset_base_value(self): + self.ensure_one() + value = self.balance + tax_non_deductible_percent = self.tax_ids.get_non_deductible_percent( + self.move_id.date or self.move_id.invoice_date, + self.move_id.company_id.id or self.env.company.id, + self.move_id.move_type in ("out_refund", "in_refund"), + ) + if tax_non_deductible_percent: + value += round( + value * tax_non_deductible_percent / 100, + self.currency_id.decimal_places, + ) + return value From d3d7f48ea47bd80cfe23037700ebb22e7a3961af Mon Sep 17 00:00:00 2001 From: mariadforgeflow Date: Fri, 1 Apr 2022 09:24:40 +0200 Subject: [PATCH 06/12] [FIX]account_asset_non_deductible: add non deductible tax amount in asset value --- .../models/__init__.py | 2 +- .../models/account_tax.py | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 account_asset_non_deductible/models/account_tax.py diff --git a/account_asset_non_deductible/models/__init__.py b/account_asset_non_deductible/models/__init__.py index a310781e3..d65525937 100644 --- a/account_asset_non_deductible/models/__init__.py +++ b/account_asset_non_deductible/models/__init__.py @@ -2,4 +2,4 @@ # Eric Antones # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -from . import account_move +from . import account_move, account_tax diff --git a/account_asset_non_deductible/models/account_tax.py b/account_asset_non_deductible/models/account_tax.py new file mode 100644 index 000000000..2e9e3b820 --- /dev/null +++ b/account_asset_non_deductible/models/account_tax.py @@ -0,0 +1,27 @@ +# Copyright NuoBiT - Eric Antones +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import models + + +class AccountTax(models.Model): + _inherit = "account.tax" + + def get_non_deductible_percent(self, date, company_id, is_refund): + value = super(AccountTax, self).get_non_deductible_percent( + date, company_id, is_refund + ) + for rec in self.filtered(lambda tax: not tax.prorate): + if rec.amount_type == "percent": + if not rec.invoice_repartition_line_ids.filtered("account_id"): + value += rec.amount + + elif rec.amount_type == "group": + for tax_child in rec.children_tax_ids: + value += tax_child.get_non_deductible_percent(date, company_id) + else: + raise NotImplementedError( + "Tax type '%s' not suported yet" % rec.amount_type + ) + + return value From 145c6f6a88791741481900963d10fcc663666242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Ra=C3=AFch?= Date: Wed, 27 Apr 2022 17:36:46 +0200 Subject: [PATCH 07/12] [FIX] account_asset_non_deductible: dependencies --- account_asset_non_deductible/__manifest__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/account_asset_non_deductible/__manifest__.py b/account_asset_non_deductible/__manifest__.py index 8aaaa5fde..6e1c85d7d 100644 --- a/account_asset_non_deductible/__manifest__.py +++ b/account_asset_non_deductible/__manifest__.py @@ -11,7 +11,6 @@ "website": "https://github.com/nuobit/odoo-addons", "license": "AGPL-3", "depends": [ - "account_asset_product_item", "l10n_es_aeat_vat_special_prorrate", ], "installable": True, From 600a03f378b25d83a1ac0bb991591d2c5feb1716 Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Tue, 7 Jun 2022 18:50:54 +0200 Subject: [PATCH 08/12] [REM] account_asset_non_deductible: code duplicated on module l10n_es_special_prorate --- account_asset_non_deductible/__manifest__.py | 2 +- .../models/__init__.py | 2 +- .../models/account_tax.py | 27 ------------------- 3 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 account_asset_non_deductible/models/account_tax.py diff --git a/account_asset_non_deductible/__manifest__.py b/account_asset_non_deductible/__manifest__.py index 6e1c85d7d..5c93673d4 100644 --- a/account_asset_non_deductible/__manifest__.py +++ b/account_asset_non_deductible/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Non-deductible asset value", "summary": "Adds a non-deductible tax amount to the asset value", - "version": "14.0.1.0.0", + "version": "14.0.1.1.0", "category": "Accounting", "author": "NuoBiT Solutions, S.L., Eric Antones", "website": "https://github.com/nuobit/odoo-addons", diff --git a/account_asset_non_deductible/models/__init__.py b/account_asset_non_deductible/models/__init__.py index d65525937..a310781e3 100644 --- a/account_asset_non_deductible/models/__init__.py +++ b/account_asset_non_deductible/models/__init__.py @@ -2,4 +2,4 @@ # Eric Antones # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -from . import account_move, account_tax +from . import account_move diff --git a/account_asset_non_deductible/models/account_tax.py b/account_asset_non_deductible/models/account_tax.py deleted file mode 100644 index 2e9e3b820..000000000 --- a/account_asset_non_deductible/models/account_tax.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright NuoBiT - Eric Antones -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) - -from odoo import models - - -class AccountTax(models.Model): - _inherit = "account.tax" - - def get_non_deductible_percent(self, date, company_id, is_refund): - value = super(AccountTax, self).get_non_deductible_percent( - date, company_id, is_refund - ) - for rec in self.filtered(lambda tax: not tax.prorate): - if rec.amount_type == "percent": - if not rec.invoice_repartition_line_ids.filtered("account_id"): - value += rec.amount - - elif rec.amount_type == "group": - for tax_child in rec.children_tax_ids: - value += tax_child.get_non_deductible_percent(date, company_id) - else: - raise NotImplementedError( - "Tax type '%s' not suported yet" % rec.amount_type - ) - - return value From 73c800ff9e0d07c45fcb4c2982f967d0986b1d6f Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Wed, 15 Oct 2025 23:29:11 +0200 Subject: [PATCH 09/12] [REF+FIX] account_asset_non_deductible: more generic and reusable prorate context structure --- account_asset_non_deductible/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_asset_non_deductible/models/account_move.py b/account_asset_non_deductible/models/account_move.py index c28edbe86..db3449cab 100644 --- a/account_asset_non_deductible/models/account_move.py +++ b/account_asset_non_deductible/models/account_move.py @@ -26,7 +26,7 @@ def _get_asset_base_value(self): value = self.balance tax_non_deductible_percent = self.tax_ids.get_non_deductible_percent( self.move_id.date or self.move_id.invoice_date, - self.move_id.company_id.id or self.env.company.id, + self.move_id.company_id or self.env.company, self.move_id.move_type in ("out_refund", "in_refund"), ) if tax_non_deductible_percent: From 8293742c2d5d0025f3538a4863cbbfe8a86fcecd Mon Sep 17 00:00:00 2001 From: ??? Date: Wed, 5 Nov 2025 15:40:50 +0100 Subject: [PATCH 10/12] [IMP] account_asset_non_deductible: pre-commit auto fixes --- account_asset_non_deductible/__manifest__.py | 2 +- account_asset_non_deductible/pyproject.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 account_asset_non_deductible/pyproject.toml diff --git a/account_asset_non_deductible/__manifest__.py b/account_asset_non_deductible/__manifest__.py index 5c93673d4..be75a958b 100644 --- a/account_asset_non_deductible/__manifest__.py +++ b/account_asset_non_deductible/__manifest__.py @@ -8,7 +8,7 @@ "version": "14.0.1.1.0", "category": "Accounting", "author": "NuoBiT Solutions, S.L., Eric Antones", - "website": "https://github.com/nuobit/odoo-addons", + "website": "https://github.com/NuoBiT/odoo-addons", "license": "AGPL-3", "depends": [ "l10n_es_aeat_vat_special_prorrate", diff --git a/account_asset_non_deductible/pyproject.toml b/account_asset_non_deductible/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/account_asset_non_deductible/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" From beabab204483ab42908a517d14e73f502344980a Mon Sep 17 00:00:00 2001 From: ??? Date: Thu, 12 Feb 2026 09:59:54 +0100 Subject: [PATCH 11/12] [MIG] account_asset_non_deductible: Migration to 18.0 --- account_asset_non_deductible/README.rst | 65 ++- account_asset_non_deductible/__init__.py | 4 - account_asset_non_deductible/__manifest__.py | 9 +- .../models/__init__.py | 4 - .../models/account_move.py | 3 +- .../readme/CONTRIBUTORS.md | 3 + .../readme/DESCRIPTION.md | 1 + .../static/description/index.html | 422 ++++++++++++++++++ 8 files changed, 486 insertions(+), 25 deletions(-) create mode 100644 account_asset_non_deductible/readme/CONTRIBUTORS.md create mode 100644 account_asset_non_deductible/readme/DESCRIPTION.md create mode 100644 account_asset_non_deductible/static/description/index.html diff --git a/account_asset_non_deductible/README.rst b/account_asset_non_deductible/README.rst index aed6e94e5..cbfcc5ef5 100644 --- a/account_asset_non_deductible/README.rst +++ b/account_asset_non_deductible/README.rst @@ -1,26 +1,71 @@ -.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png - :target: https://www.gnu.org/licenses/agpl - :alt: License: AGPL-3 - ========================== Non-deductible asset value ========================== -* This module adds a non-deductible tax amount to the asset value +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5ecdbed39965427e76c3ced2a87e52167f23eab1ff7b1c7d8351f183cadc6253 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/account_asset_non_deductible + :alt: NuoBiT/odoo-addons + +|badge1| |badge2| |badge3| + +Adds a non-deductible tax amount to the asset value +**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 ------------ -* Eric Antones +- `NuoBiT `__: + + - Eric Antones eantones@nuobit.com + - Deniz Gallo dgallo@nuobit.com + +Maintainers +----------- + +.. |maintainer-eantones| image:: https://github.com/eantones.png?size=40px + :target: https://github.com/eantones + :alt: eantones + +Current maintainer: + +|maintainer-eantones| + +This module is part of the `NuoBiT/odoo-addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/account_asset_non_deductible/__init__.py b/account_asset_non_deductible/__init__.py index 38b2ba65b..0650744f6 100644 --- a/account_asset_non_deductible/__init__.py +++ b/account_asset_non_deductible/__init__.py @@ -1,5 +1 @@ -# Copyright NuoBiT Solutions, S.L. () -# Eric Antones -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) - from . import models diff --git a/account_asset_non_deductible/__manifest__.py b/account_asset_non_deductible/__manifest__.py index be75a958b..1fc8bf2d5 100644 --- a/account_asset_non_deductible/__manifest__.py +++ b/account_asset_non_deductible/__manifest__.py @@ -1,19 +1,18 @@ -# Copyright NuoBiT Solutions, S.L. () -# Eric Antones +# Copyright NuoBiT Solutions SL - Eric Antones +# Copyright 2025 NuoBiT Solutions SL - Deniz Gallo # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) { "name": "Non-deductible asset value", "summary": "Adds a non-deductible tax amount to the asset value", - "version": "14.0.1.1.0", + "version": "18.0.1.0.0", "category": "Accounting", - "author": "NuoBiT Solutions, S.L., Eric Antones", + "author": "NuoBiT Solutions SL", "website": "https://github.com/NuoBiT/odoo-addons", "license": "AGPL-3", "depends": [ "l10n_es_aeat_vat_special_prorrate", ], - "installable": True, "development_status": "Beta", "maintainers": ["eantones"], } diff --git a/account_asset_non_deductible/models/__init__.py b/account_asset_non_deductible/models/__init__.py index a310781e3..9c0a42138 100644 --- a/account_asset_non_deductible/models/__init__.py +++ b/account_asset_non_deductible/models/__init__.py @@ -1,5 +1 @@ -# Copyright NuoBiT Solutions, S.L. () -# Eric Antones -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) - from . import account_move diff --git a/account_asset_non_deductible/models/account_move.py b/account_asset_non_deductible/models/account_move.py index db3449cab..d90dc31b7 100644 --- a/account_asset_non_deductible/models/account_move.py +++ b/account_asset_non_deductible/models/account_move.py @@ -1,5 +1,4 @@ -# Copyright NuoBiT Solutions, S.L. () -# Eric Antones +# Copyright NuoBiT Solutions SL - Eric Antones # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) from odoo import models diff --git a/account_asset_non_deductible/readme/CONTRIBUTORS.md b/account_asset_non_deductible/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..909507cba --- /dev/null +++ b/account_asset_non_deductible/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [NuoBiT](https://www.nuobit.com): + - Eric Antones + - Deniz Gallo diff --git a/account_asset_non_deductible/readme/DESCRIPTION.md b/account_asset_non_deductible/readme/DESCRIPTION.md new file mode 100644 index 000000000..644832e67 --- /dev/null +++ b/account_asset_non_deductible/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Adds a non-deductible tax amount to the asset value diff --git a/account_asset_non_deductible/static/description/index.html b/account_asset_non_deductible/static/description/index.html new file mode 100644 index 000000000..ae6309ec3 --- /dev/null +++ b/account_asset_non_deductible/static/description/index.html @@ -0,0 +1,422 @@ + + + + + +Non-deductible asset value + + + +
+

Non-deductible asset value

+ + +

Beta License: AGPL-3 NuoBiT/odoo-addons

+

Adds a non-deductible tax amount to the asset value

+

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

+

Current maintainer:

+

eantones

+

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

+

You are welcome to contribute.

+
+
+
+ + From c0ef0b3df964051f8c11052535aabb70e11ebf55 Mon Sep 17 00:00:00 2001 From: ??? Date: Tue, 24 Feb 2026 11:32:43 +0100 Subject: [PATCH 12/12] [DO NOT MERGE] test-requirements.txt --- test-requirements.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 test-requirements.txt 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