From ea53259d278d5f9bc6a9f285fed5a544a0b38823 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 17 Oct 2016 11:54:19 +0200 Subject: [PATCH] [FIX] account_asset: inconsistencies deferred revenues and assets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following configuration leads to different results: - Deferred revenue: 12 entries, 1/month, prorata temporis, 1000€, date 15th of October - Asset: 12 entries, 1/month, prorata temporis, 1000€, linear, date 15th of October Deferred revenues and assets should give identical results. opw-690034 --- addons/account_asset/account_asset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index d5f726c6b36..856f4482e02 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -126,7 +126,7 @@ class AccountAssetAsset(models.Model): else: if self.method == 'linear': amount = amount_to_depr / (undone_dotation_number - len(posted_depreciation_line_ids)) - if self.prorata and self.category_id.type == 'purchase': + if self.prorata: amount = amount_to_depr / self.method_number if sequence == 1: days = (self.company_id.compute_fiscalyear_dates(depreciation_date)['date_to'] - depreciation_date).days + 1 @@ -147,7 +147,7 @@ class AccountAssetAsset(models.Model): while depreciation_date <= end_date: depreciation_date = date(depreciation_date.year, depreciation_date.month, depreciation_date.day) + relativedelta(months=+self.method_period) undone_dotation_number += 1 - if self.prorata and self.category_id.type == 'purchase': + if self.prorata: undone_dotation_number += 1 return undone_dotation_number