[FIX] account_asset_management: include 'number' method_time

This commit is contained in:
mreficent
2021-04-19 13:04:19 +02:00
parent 5e0215d678
commit a4bedab0df
3 changed files with 44 additions and 10 deletions

View File

@@ -17,7 +17,7 @@ class TestAssetManagement(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
# ENVIRONEMENTS
# ENVIRONMENTS
cls.asset_model = cls.env["account.asset"]
cls.asset_profile_model = cls.env["account.asset.profile"]
cls.dl_model = cls.env["account.asset.line"]
@@ -731,3 +731,32 @@ class TestAssetManagement(AccountTestInvoicingCommon):
[(group_tfa.id, "Tangible Fixed A...")],
)
self.assertFalse(self.env["account.asset.group"].name_search("stessA dexiF"))
def test_16_use_number_of_depreciations(self):
# When you run a depreciation with method = 'number'
profile = self.car5y
profile.method_time = "number"
asset = self.asset_model.create(
{
"name": "test asset",
"profile_id": profile.id,
"purchase_value": 10000,
"salvage_value": 0,
"date_start": time.strftime("2019-01-01"),
"method_time": "year",
"method_number": 5,
"method_period": "month",
"prorata": False,
"days_calc": False,
"use_leap_years": False,
}
)
asset.compute_depreciation_board()
asset.refresh()
for _i in range(1, 11):
self.assertAlmostEqual(
asset.depreciation_line_ids[1].amount, 166.67, places=2
)
# In the last month of the fiscal year we compensate for the small
# deviations if that is necessary.
self.assertAlmostEqual(asset.depreciation_line_ids[12].amount, 166.63, places=2)