Skip to content

Commit

Permalink
[14.0][FIX] do not create depreciation lines with zero amount
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocorato committed Feb 28, 2024
1 parent 76a8e12 commit 73c7ce3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion assets_management/models/asset_depreciation.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ def generate_depreciation_lines(self, dep_date):

new_lines = self.env["asset.depreciation.line"]
for dep in self:
new_lines |= dep.generate_depreciation_lines_single(dep_date)
new_line = dep.generate_depreciation_lines_single(dep_date)

Check warning on line 289 in assets_management/models/asset_depreciation.py

View check run for this annotation

Codecov / codecov/patch

assets_management/models/asset_depreciation.py#L289

Added line #L289 was not covered by tests
if new_line:
new_lines |= new_line

return new_lines

Expand All @@ -298,6 +300,8 @@ def generate_depreciation_lines_single(self, dep_date):
dep_nr = self.get_max_depreciation_nr() + 1
dep = self.with_context(dep_nr=dep_nr, used_asset=self.asset_id.used)
dep_amount = dep.get_depreciation_amount(dep_date)
if not dep_amount:
return res
dep = dep.with_context(dep_amount=dep_amount)

vals = dep.prepare_depreciation_line_vals(dep_date)
Expand Down

0 comments on commit 73c7ce3

Please sign in to comment.