From 18057ddb5e7a535597ecaf8bb9cd0c675bb74aa7 Mon Sep 17 00:00:00 2001 From: Anand Baburajan Date: Mon, 1 May 2023 19:53:39 +0530 Subject: [PATCH] fix: handle expected_value_after_useful_life properly in asset value adjustment (#35117) (cherry picked from commit 80230fec3ef079b75825447a61836f8a9ce64f57) --- .../doctype/asset_value_adjustment/asset_value_adjustment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py index 021332883d8c..8426ed43ff2a 100644 --- a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py +++ b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py @@ -150,7 +150,9 @@ def reschedule_depreciations(self, asset_value): if d.depreciation_method in ("Straight Line", "Manual"): end_date = max(s.schedule_date for s in depr_schedule) total_days = date_diff(end_date, self.date) - rate_per_day = flt(d.value_after_depreciation) / flt(total_days) + rate_per_day = flt(d.value_after_depreciation - d.expected_value_after_useful_life) / flt( + total_days + ) from_date = self.date else: no_of_depreciations = len([s.name for s in depr_schedule if not s.journal_entry])