2
0

[FIX] account_asset_management: fix remaining_value cache miss error.

This commit is contained in:
Ernesto Tejeda 2020-07-08 20:11:10 -04:00 committed by Rodrigo
parent 009b0b494a
commit a555ed9259
2 changed files with 6 additions and 2 deletions

View File

@ -4,7 +4,7 @@
{ {
"name": "Assets Management", "name": "Assets Management",
"version": "13.0.1.1.0", "version": "13.0.1.1.1",
"license": "AGPL-3", "license": "AGPL-3",
"depends": ["account"], "depends": ["account"],
"excludes": ["account_asset"], "excludes": ["account_asset"],

View File

@ -70,7 +70,11 @@ class AccountAssetLine(models.Model):
dlines = self.filtered(lambda l: l.id not in exclude_ids) dlines = self.filtered(lambda l: l.id not in exclude_ids)
dlines = dlines.filtered(lambda l: l.type == "depreciate") dlines = dlines.filtered(lambda l: l.type == "depreciate")
dlines = dlines.sorted(key=lambda l: l.line_date) dlines = dlines.sorted(key=lambda l: l.line_date)
# Give value 0 to the lines that are not going to be calculated
# to avoid cache miss error
all_excluded_lines = self - dlines
all_excluded_lines.depreciated_value = 0
all_excluded_lines.remaining_value = 0
# Group depreciation lines per asset # Group depreciation lines per asset
asset_ids = dlines.mapped("asset_id") asset_ids = dlines.mapped("asset_id")
grouped_dlines = [] grouped_dlines = []