Skip to content

Commit

Permalink
fix: precision check for salvage value
Browse files Browse the repository at this point in the history
  • Loading branch information
khushi8112 committed Dec 10, 2024
1 parent 01d1c67 commit da09316
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 da09316

Please sign in to comment.