fix: Value after depreciation fixes in asset,

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index 306fb14..6e2bbc1 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -20,12 +20,7 @@
 		self.validate_asset_values()
 		self.validate_item()
 		self.set_missing_values()
-		if self.calculate_depreciation:
-			self.set_depreciation_rate()
-			self.make_depreciation_schedule()
-			self.set_accumulated_depreciation()
-		else:
-			self.finance_books = []
+		self.prepare_depreciation_data()
 		if self.get("schedules"):
 			self.validate_expected_value_after_useful_life()
 
@@ -45,6 +40,17 @@
 		delete_gl_entries(voucher_type='Asset', voucher_no=self.name)
 		self.db_set('booked_fixed_asset', 0)
 
+	def prepare_depreciation_data(self):
+		if self.calculate_depreciation:
+			self.value_after_depreciation = 0
+			self.set_depreciation_rate()
+			self.make_depreciation_schedule()
+			self.set_accumulated_depreciation()
+		else:
+			self.finance_books = []
+			self.value_after_depreciation = (flt(self.gross_purchase_amount) -
+				flt(self.opening_accumulated_depreciation))
+
 	def validate_item(self):
 		item = frappe.get_cached_value("Item", self.item_code,
 			["is_fixed_asset", "is_stock_item", "disabled"], as_dict=1)
diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py
index e911e80..2d23f77 100644
--- a/erpnext/assets/doctype/asset/depreciation.py
+++ b/erpnext/assets/doctype/asset/depreciation.py
@@ -188,7 +188,8 @@
 				idx = d.idx
 				break
 
-	value_after_depreciation = asset.finance_books[idx - 1].value_after_depreciation
+	value_after_depreciation = (asset.finance_books[idx - 1].value_after_depreciation
+		if asset.calculate_depreciation else asset.value_after_depreciation)
 	accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(value_after_depreciation)
 
 	gl_entries = [