Skip to content
Snippets Groups Projects
Commit bb6013f6 authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] account_asset: compute_depreciation_board

The last depreciation date must be take from the last posted depreciation
line.

opw:679212
parent d1fa3350
Branches
Tags
No related merge requests found
......@@ -168,8 +168,8 @@ class AccountAssetAsset(models.Model):
# depreciation_date = 1st of January of purchase year
asset_date = datetime.strptime(self.date[:4] + '-01-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[0].depreciation_date:
last_depreciation_date = datetime.strptime(posted_depreciation_line_ids[0].depreciation_date, DF).date()
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()
depreciation_date = last_depreciation_date + relativedelta(months=+self.method_period)
else:
depreciation_date = asset_date
......@@ -179,6 +179,7 @@ class AccountAssetAsset(models.Model):
total_days = (year % 4) and 365 or 366
undone_dotation_number = self._compute_board_undone_dotation_nb(depreciation_date, total_days)
for x in range(len(posted_depreciation_line_ids), undone_dotation_number):
sequence = x + 1
amount = self._compute_board_amount(sequence, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment