[FIX] account_asset: ordered posted depreciation lines

To recompute the depreciation board the last depreciation date must be
taken.

opw:679212
This commit is contained in:
Goffin Simon
2016-06-15 11:09:45 +02:00
parent 9eac70db35
commit b7970130e5
+1 -1
View File
@@ -154,7 +154,7 @@ class AccountAssetAsset(models.Model):
def compute_depreciation_board(self):
self.ensure_one()
posted_depreciation_line_ids = self.depreciation_line_ids.filtered(lambda x: x.move_check).sorted(key=lambda l: l.depreciation_date, reverse=True)
posted_depreciation_line_ids = self.depreciation_line_ids.filtered(lambda x: x.move_check).sorted(key=lambda l: l.depreciation_date)
unposted_depreciation_line_ids = self.depreciation_line_ids.filtered(lambda x: not x.move_check)
# Remove old unposted depreciation lines. We cannot use unlink() with One2many field