Skip to content

Commit ed42ed0

Browse files
committed
fix: make rate of depreciation mandatory
1 parent 632a45d commit ed42ed0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

erpnext/assets/doctype/asset/asset.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -804,10 +804,10 @@ def get_depreciation_rate(self, args, on_validate=False):
804804
):
805805
return args.get("rate_of_depreciation")
806806

807-
if self.flags.increase_in_asset_value_due_to_repair:
808-
if not flt(args.get("expected_value_after_useful_life")):
809-
return args.get("rate_of_depreciation")
807+
if args.get("rate_of_depreciation") and not flt(args.get("expected_value_after_useful_life")):
808+
return args.get("rate_of_depreciation")
810809

810+
if self.flags.increase_in_asset_value_due_to_repair:
811811
value = flt(args.get("expected_value_after_useful_life")) / flt(
812812
args.get("value_after_depreciation")
813813
)

erpnext/assets/doctype/asset_finance_book/asset_finance_book.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
"description": "In Percentage",
8787
"fieldname": "rate_of_depreciation",
8888
"fieldtype": "Percent",
89-
"label": "Rate of Depreciation"
89+
"label": "Rate of Depreciation (%)",
90+
"mandatory_depends_on": "eval:doc.depreciation_method == 'Written Down Value'"
9091
},
9192
{
9293
"fieldname": "salvage_value_percentage",
@@ -117,7 +118,7 @@
117118
"index_web_pages_for_search": 1,
118119
"istable": 1,
119120
"links": [],
120-
"modified": "2024-05-21 15:48:20.907250",
121+
"modified": "2024-12-13 12:11:03.743209",
121122
"modified_by": "Administrator",
122123
"module": "Assets",
123124
"name": "Asset Finance Book",

0 commit comments

Comments
 (0)