fix: Replace asset life with total no of depreciations
This commit is contained in:
parent
79d5d35df9
commit
ab13a178b5
@ -849,14 +849,10 @@ class Asset(AccountsController):
|
||||
if args.get("rate_of_depreciation") and on_validate:
|
||||
return args.get("rate_of_depreciation")
|
||||
|
||||
no_of_years = (
|
||||
flt(args.get("total_number_of_depreciations") * flt(args.get("frequency_of_depreciation")))
|
||||
/ 12
|
||||
)
|
||||
value = flt(args.get("expected_value_after_useful_life")) / flt(self.gross_purchase_amount)
|
||||
|
||||
# square root of flt(salvage_value) / flt(asset_cost)
|
||||
depreciation_rate = math.pow(value, 1.0 / flt(no_of_years, 2))
|
||||
depreciation_rate = math.pow(value, 1.0 / flt(args.get("total_number_of_depreciations"), 2))
|
||||
|
||||
return 100 * (1 - flt(depreciation_rate, float_precision))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user