Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle zero salvage value case #44690

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions erpnext/assets/doctype/asset/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,9 @@ def get_depreciation_rate(self, args, on_validate=False):
):
return args.get("rate_of_depreciation")

if args.get("rate_of_depreciation") and not flt(args.get("expected_value_after_useful_life")):
return args.get("rate_of_depreciation")

if self.flags.increase_in_asset_value_due_to_repair:
value = flt(args.get("expected_value_after_useful_life")) / flt(
args.get("value_after_depreciation")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
"depends_on": "eval:doc.depreciation_method == 'Written Down Value'",
"fieldname": "rate_of_depreciation",
"fieldtype": "Percent",
"label": "Rate of Depreciation (%)"
"label": "Rate of Depreciation (%)",
"mandatory_depends_on": "eval:doc.depreciation_method == 'Written Down Value'"
},
{
"fieldname": "salvage_value_percentage",
Expand Down Expand Up @@ -128,7 +129,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-11-29 14:36:54.399034",
"modified": "2024-12-13 12:11:03.743209",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Finance Book",
Expand Down
Loading