[FIX] account_asset: inconsistencies deferred revenues and assets

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
This commit is contained in:
Nicolas Martinelli
2016-10-17 14:20:19 +02:00
parent b14c8b361c
commit ea53259d27
+2 -2
View File
@@ -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