From 065a2ce98330b57043a6b202a1814e106145128b Mon Sep 17 00:00:00 2001 From: Saqib Date: Tue, 5 Oct 2021 11:14:16 +0530 Subject: [PATCH] fix(asset): expected value after useful life validation (#27539) --- erpnext/assets/doctype/asset/asset.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 39f102e143..7e135be30b 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -140,11 +140,6 @@ class Asset(AccountsController): if self.is_existing_asset: return - docname = self.purchase_receipt or self.purchase_invoice - if docname: - doctype = 'Purchase Receipt' if self.purchase_receipt else 'Purchase Invoice' - date = frappe.db.get_value(doctype, docname, 'posting_date') - if self.available_for_use_date and getdate(self.available_for_use_date) < getdate(self.purchase_date): frappe.throw(_("Available-for-use Date should be after purchase date")) @@ -440,9 +435,10 @@ class Asset(AccountsController): if accumulated_depreciation_after_full_schedule: accumulated_depreciation_after_full_schedule = max(accumulated_depreciation_after_full_schedule) - asset_value_after_full_schedule = flt(flt(self.gross_purchase_amount) - - flt(accumulated_depreciation_after_full_schedule), - self.precision('gross_purchase_amount')) + asset_value_after_full_schedule = flt( + flt(self.gross_purchase_amount) - + flt(self.opening_accumulated_depreciation) - + flt(accumulated_depreciation_after_full_schedule), self.precision('gross_purchase_amount')) if (row.expected_value_after_useful_life and row.expected_value_after_useful_life < asset_value_after_full_schedule):