From 162edf276c6e08e08aca36f6978675d07980fed7 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 23 Jun 2016 15:08:02 +0200 Subject: [PATCH] [FIX] account_asset: depreciation start date If the depreciation is not prorata temporis, the start date is defined as: - 1st of purchase month if frequency is < 12 month - 1st of January instead opw-681564 --- addons/account_asset/account_asset.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 951c28a8a7a..dd68362da39 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -165,8 +165,12 @@ class AccountAssetAsset(models.Model): if self.prorata: depreciation_date = datetime.strptime(self._get_last_depreciation_date()[self.id], DF).date() else: - # depreciation_date = 1st of January of purchase year - asset_date = datetime.strptime(self.date[:4] + '-01-01', DF).date() + # depreciation_date = 1st of January of purchase year if annual valuation, 1st of + # purchase month in other cases + if self.method_period >= 12: + asset_date = datetime.strptime(self.date[:4] + '-01-01', DF).date() + else: + asset_date = datetime.strptime(self.date[:7] + '-01', DF).date() # if we already have some previous validated entries, starting date isn't 1st January but last entry + method period if posted_depreciation_line_ids and posted_depreciation_line_ids[-1].depreciation_date: last_depreciation_date = datetime.strptime(posted_depreciation_line_ids[-1].depreciation_date, DF).date()