diff --git a/account_asset_management/README.rst b/account_asset_management/README.rst index 4b4eb88d2..580c1f1ee 100644 --- a/account_asset_management/README.rst +++ b/account_asset_management/README.rst @@ -20,7 +20,7 @@ Excel based reporting is available via the 'account_asset_management_xls' module The module contains a large number of functional enhancements compared to the standard account_asset module from Odoo. -* When the depreciation board an asset is compute, lines computed are flagged 'Init' +* When you compute the asset depreciation board, lines are flagged 'Init' if they are before **Lock Date** `fiscalyear_lock_date` Configuration diff --git a/account_asset_management/models/account_asset.py b/account_asset_management/models/account_asset.py index 4c6f93f06..02efcb7b7 100644 --- a/account_asset_management/models/account_asset.py +++ b/account_asset_management/models/account_asset.py @@ -616,7 +616,7 @@ class AccountAsset(models.Model): - years: duration in calendar years, considering also leap years """ fy = self.env['date.range'].browse(fy_id) - fy_date_start =fields.Datetime.from_string(fy.date_start) + fy_date_start = fields.Datetime.from_string(fy.date_start) fy_date_stop = fields.Datetime.from_string(fy.date_end) days = (fy_date_stop - fy_date_start).days + 1 months = (fy_date_stop.year - fy_date_start.year) * 12 \ @@ -809,11 +809,12 @@ class AccountAsset(models.Model): return line_dates def _compute_depreciation_table_lines( - self, table, - depreciation_start_date, - depreciation_stop_date, - line_dates, - fiscalyear_lock_date): + self, + table, + depreciation_start_date, + depreciation_stop_date, + line_dates, + fiscalyear_lock_date): digits = self.env['decimal.precision'].precision_get('Account') asset_sign = 1 if self.depreciation_base >= 0 else -1 diff --git a/account_asset_management_method_number_end/tests/test_account_asset_management.py b/account_asset_management_method_number_end/tests/test_account_asset_management.py index 8677e1686..0045ed06d 100644 --- a/account_asset_management_method_number_end/tests/test_account_asset_management.py +++ b/account_asset_management_method_number_end/tests/test_account_asset_management.py @@ -3,6 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import time +from datetime import date import odoo.tests.common as common from odoo import tools @@ -27,6 +28,13 @@ class TestAssetManagement(common.TransactionCase): self.asset_model = self.env['account.asset'] self.dl_model = self.env['account.asset.line'] + # Instance: Account settings + self.acs_model = self.env['account.config.settings'] + + values = {'fiscalyear_lock_date': "%s-12-31" % (date.today().year - 2)} + + self.acs_model.create(values) + def test_1_linear_number(self): """Linear with Method Time 'Number'.""" asset = self.asset_model.create({