diff --git a/account_asset_management/README.rst b/account_asset_management/README.rst index dc552c0b..0156576c 100644 --- a/account_asset_management/README.rst +++ b/account_asset_management/README.rst @@ -14,13 +14,13 @@ Assets Management :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github - :target: https://github.com/OCA/account-financial-tools/tree/13.0/account_asset_management + :target: https://github.com/OCA/account-financial-tools/tree/14.0/account_asset_management :alt: OCA/account-financial-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_asset_management + :target: https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_asset_management :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/92/13.0 + :target: https://runbot.odoo-community.org/runbot/92/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -60,6 +60,11 @@ The module in NOT compatible with the standard account_asset module. Changelog ========= +14.0.1.0.0 (2021-01-08) +~~~~~~~~~~~~~~~~~~~~~~~ + + * [BREAKING] Removed all functionality associated with `account.fiscal.year` + 13.0.1.0.0 (2019-10-21) ~~~~~~~~~~~~~~~~~~~~~~~ @@ -94,7 +99,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -124,6 +129,7 @@ Contributors * Ernesto Tejeda * Pedro M. Baeza + * João Marques Maintainers ~~~~~~~~~~~ @@ -138,6 +144,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/account-financial-tools `_ project on GitHub. +This module is part of the `OCA/account-financial-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_asset_management/__manifest__.py b/account_asset_management/__manifest__.py index 6179462c..d94f2ba0 100644 --- a/account_asset_management/__manifest__.py +++ b/account_asset_management/__manifest__.py @@ -1,10 +1,11 @@ # Copyright 2009-2018 Noviat # Copyright 2019 Tecnativa - Pedro M. Baeza +# Copyright 2021 Tecnativa - João Marques # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Assets Management", - "version": "13.0.1.3.2", + "version": "14.0.1.0.0", "license": "AGPL-3", "depends": ["account"], "excludes": ["account_asset"], diff --git a/account_asset_management/migrations/13.0.1.1.3/post-migration.py b/account_asset_management/migrations/13.0.1.1.3/post-migration.py deleted file mode 100644 index 2eff856c..00000000 --- a/account_asset_management/migrations/13.0.1.1.3/post-migration.py +++ /dev/null @@ -1,27 +0,0 @@ -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from odoo import SUPERUSER_ID, api - - -def migrate(cr, version): - with api.Environment.manage(): - env = api.Environment(cr, SUPERUSER_ID, {}) - domain = "['|',('company_id','=',False),('company_id','in',company_ids)]" - rule = env.ref( - "account_asset_management.account_asset_profile_multi_company_rule", - raise_if_not_found=False, - ) - if rule: - rule.write({"domain_force": domain}) - rule = env.ref( - "account_asset_management.account_asset_multi_company_rule", - raise_if_not_found=False, - ) - if rule: - rule.write({"domain_force": domain}) - rule = env.ref( - "account_asset_management.account_asset_group_multi_company_rule", - raise_if_not_found=False, - ) - if rule: - rule.write({"domain_force": domain}) diff --git a/account_asset_management/models/__init__.py b/account_asset_management/models/__init__.py index b64596fd..8a0a9df1 100644 --- a/account_asset_management/models/__init__.py +++ b/account_asset_management/models/__init__.py @@ -4,5 +4,4 @@ from . import account_asset_group from . import account_asset_profile from . import account_asset_line from . import account_asset_recompute_trigger -from . import account_fiscal_year from . import account_move diff --git a/account_asset_management/models/account_asset.py b/account_asset_management/models/account_asset.py index 0a314c30..95ebfa09 100644 --- a/account_asset_management/models/account_asset.py +++ b/account_asset_management/models/account_asset.py @@ -45,8 +45,16 @@ class AccountAsset(models.Model): move_line_check = fields.Boolean( compute="_compute_move_line_check", string="Has accounting entries" ) - name = fields.Char(string="Asset Name", required=True, states=READONLY_STATES,) - code = fields.Char(string="Reference", size=32, states=READONLY_STATES,) + name = fields.Char( + string="Asset Name", + required=True, + states=READONLY_STATES, + ) + code = fields.Char( + string="Reference", + size=32, + states=READONLY_STATES, + ) purchase_value = fields.Float( string="Purchase Value", required=True, @@ -133,7 +141,9 @@ class AccountAsset(models.Model): ) active = fields.Boolean(default=True) partner_id = fields.Many2one( - comodel_name="res.partner", string="Partner", states=READONLY_STATES, + comodel_name="res.partner", + string="Partner", + states=READONLY_STATES, ) method = fields.Selection( selection=lambda self: self.env["account.asset.profile"]._selection_method(), diff --git a/account_asset_management/models/account_asset_line.py b/account_asset_management/models/account_asset_line.py index 1d6a5c4a..0758f489 100644 --- a/account_asset_management/models/account_asset_line.py +++ b/account_asset_management/models/account_asset_line.py @@ -1,4 +1,5 @@ # Copyright 2009-2018 Noviat +# Copyright 2021 Tecnativa - João Marques # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import _, api, fields, models @@ -255,7 +256,7 @@ class AccountAssetLine(models.Model): depreciation_date, exp_acc, "expense", move ) self.env["account.move.line"].with_context(ctx).create(aml_e_vals) - move.post() + move.action_post() line.with_context(allow_asset_line_update=True).write({"move_id": move.id}) created_move_ids.append(move.id) asset_ids.add(asset.id) diff --git a/account_asset_management/models/account_fiscal_year.py b/account_asset_management/models/account_fiscal_year.py deleted file mode 100644 index 21dade86..00000000 --- a/account_asset_management/models/account_fiscal_year.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2009-2017 Noviat -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import logging -import time -from datetime import datetime - -from dateutil.relativedelta import relativedelta - -from odoo import api, models -from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT - -_logger = logging.getLogger(__name__) - - -class AccountFiscalYear(models.Model): - _inherit = "account.fiscal.year" - - @api.model - def create(self, vals): - date_from = datetime.strptime(vals.get("date_from"), "%Y-%m-%d") - date_to = datetime.strptime(vals.get("date_to"), "%Y-%m-%d") - if not date_to == date_from + relativedelta(years=1, days=-1): - recompute_vals = { - "reason": "creation of fiscalyear %s" % vals.get("name"), - "company_id": vals.get("company_id") or self.env.user.company_id.id, - "date_trigger": time.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - "state": "open", - } - self.env["account.asset.recompute.trigger"].sudo().create(recompute_vals) - return super().create(vals) - - def write(self, vals): - if vals.get("date_from") or vals.get("date_to"): - for fy in self: - recompute_vals = { - "reason": "duration change of fiscalyear %s" % fy.name, - "company_id": fy.company_id.id, - "date_trigger": time.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - "state": "open", - } - self.env["account.asset.recompute.trigger"].sudo().create( - recompute_vals - ) - return super().write(vals) diff --git a/account_asset_management/models/account_move.py b/account_asset_management/models/account_move.py index 48e62ac2..a29f14a1 100644 --- a/account_asset_management/models/account_move.py +++ b/account_asset_management/models/account_move.py @@ -1,4 +1,5 @@ # Copyright 2009-2018 Noviat +# Copyright 2021 Tecnativa - João Marques # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import logging @@ -58,11 +59,11 @@ class AccountMove(models.Model): ) return super().write(vals) - def post(self): - super().post() + def action_post(self): + super().action_post() for move in self: for aml in move.line_ids.filtered("asset_profile_id"): - depreciation_base = aml.debit or -aml.credit + depreciation_base = aml.price_subtotal vals = { "name": aml.name, "code": move.name, diff --git a/account_asset_management/readme/CONTRIBUTORS.rst b/account_asset_management/readme/CONTRIBUTORS.rst index 4504972b..c49f22e7 100644 --- a/account_asset_management/readme/CONTRIBUTORS.rst +++ b/account_asset_management/readme/CONTRIBUTORS.rst @@ -13,3 +13,4 @@ * Ernesto Tejeda * Pedro M. Baeza + * João Marques diff --git a/account_asset_management/readme/HISTORY.rst b/account_asset_management/readme/HISTORY.rst index 85492f51..de8ef0ee 100644 --- a/account_asset_management/readme/HISTORY.rst +++ b/account_asset_management/readme/HISTORY.rst @@ -1,3 +1,8 @@ +14.0.1.0.0 (2021-01-08) +~~~~~~~~~~~~~~~~~~~~~~~ + + * [BREAKING] Removed all functionality associated with `account.fiscal.year` + 13.0.1.0.0 (2019-10-21) ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/account_asset_management/security/ir.model.access.csv b/account_asset_management/security/ir.model.access.csv index 9ea3d817..2ac1210b 100644 --- a/account_asset_management/security/ir.model.access.csv +++ b/account_asset_management/security/ir.model.access.csv @@ -13,3 +13,5 @@ access_account_asset_recompute_trigger_manager,account.asset.recompute.trigger,m access_account_asset_group_invoice,account.asset.group,model_account_asset_group,account.group_account_invoice,1,0,0,0 access_account_asset_group_user,account.asset.group,model_account_asset_group,account.group_account_user,1,0,0,0 access_account_asset_group_manager,account.asset.group,model_account_asset_group,account.group_account_manager,1,1,1,1 +access_account_asset_remove_user,account.asset.remove,model_account_asset_remove,account.group_account_user,1,1,1,1 +access_account_asset_compute_user,account.asset.compute,model_account_asset_compute,account.group_account_user,1,1,1,1 diff --git a/account_asset_management/static/description/index.html b/account_asset_management/static/description/index.html index 9651e93a..ecf00073 100644 --- a/account_asset_management/static/description/index.html +++ b/account_asset_management/static/description/index.html @@ -3,7 +3,7 @@ - + Assets Management