From da09316d4c7071994dee0cc8864e400ba1ed04ed Mon Sep 17 00:00:00 2001 From: Khushi Rawat <142375893+khushi8112@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:54:02 +0530 Subject: [PATCH] fix: precision check for salvage value --- erpnext/assets/doctype/asset/asset.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 205880ca9d5a..9b124826fcec 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -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( @@ -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(