Skip to content

Commit

Permalink
Merge pull request #44631 from khushi8112/salvage-value-precision
Browse files Browse the repository at this point in the history
fix: precision check for salvage value
  • Loading branch information
khushi8112 authored Dec 10, 2024
2 parents 01d1c67 + da09316 commit 968762c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion erpnext/assets/doctype/asset/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ def set_depreciation_rate(self):
)

def validate_asset_finance_books(self, row):
row.expected_value_after_useful_life = flt(
row.expected_value_after_useful_life, self.precision("gross_purchase_amount")
)
if flt(row.expected_value_after_useful_life) >= flt(self.gross_purchase_amount):
frappe.throw(
_("Row {0}: Expected Value After Useful Life must be less than Gross Purchase Amount").format(
Expand All @@ -431,7 +434,10 @@ def validate_asset_finance_books(self, row):
self.opening_accumulated_depreciation = 0
self.opening_number_of_booked_depreciations = 0
else:
depreciable_amount = flt(self.gross_purchase_amount) - flt(row.expected_value_after_useful_life)
depreciable_amount = flt(
flt(self.gross_purchase_amount) - flt(row.expected_value_after_useful_life),
self.precision("gross_purchase_amount"),
)
if flt(self.opening_accumulated_depreciation) > depreciable_amount:
frappe.throw(
_("Opening Accumulated Depreciation must be less than or equal to {0}").format(
Expand Down

0 comments on commit 968762c

Please sign in to comment.