Skip to content

Commit

Permalink
fix: consider opening asset values while calculating asset depreciati…
Browse files Browse the repository at this point in the history
…on rate
  • Loading branch information
khushi8112 committed Oct 29, 2024
1 parent 0c93bc3 commit 9d0fe7a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions erpnext/assets/doctype/asset/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,14 +791,19 @@ def get_depreciation_rate(self, args, on_validate=False):
args.get("value_after_depreciation")
)
else:
value = flt(args.get("expected_value_after_useful_life")) / flt(self.gross_purchase_amount)
value = flt(args.get("expected_value_after_useful_life")) / (
flt(self.gross_purchase_amount) - flt(self.opening_accumulated_depreciation)
)

depreciation_rate = math.pow(
value,
1.0
/ (
(
flt(args.get("total_number_of_depreciations"), 2)
(
flt(args.get("total_number_of_depreciations"), 2)
- flt(self.opening_number_of_booked_depreciations)
)
* flt(args.get("frequency_of_depreciation"))
)
/ 12
Expand Down

0 comments on commit 9d0fe7a

Please sign in to comment.